PyMongoExplain 1.0.0 Released

We are pleased to announce the release of PyMongoExplain, an easier way to run explain on PyMongo commands.
PyMongoExplain greatly simplifies the amount of effort needed to explain commands. For example, suppose we wanted to explain the following update_one:

collection.update_one({"quantity": 1057, "category": "apparel"},{"$set": {"reorder": True}})

Before PyMongoExplain, one would need to convert the update_one into the equivalent MongoDB command:

collection.database.command(SON([('explain', SON([('update', 'products'), ('updates', [{'q': {'quantity': 1057, 'category': 'apparel'}, 'upsert': False, 'multi': False, 'u': {'$set': {'reorder': True}}}])])), ('verbosity', 'queryPlanner')]))

After PyMongoExplain:

ExplainCollection(collection).update_one({"quantity": 1057, "category": "apparel"},{"$set": {"reorder": True}})

Links:

3 Likes