Skip to content

Commit 881b29a

Browse files
authored
Add elevator pitch (#29)
1 parent 95fa9bd commit 881b29a

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

README.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ About
1111
=====
1212
This package provides an ``ExplainCollection`` class that allows PyMongo's Collection methods to be explained_
1313

14+
PyMongoExplain greatly simplifies the amount of effort needed to explain commands.
15+
For example, suppose we wanted to explain the following ``update_one``::
16+
17+
collection.update_one({"quantity": 1057, "category": "apparel"},{"$set": {"reorder": True}})
18+
19+
20+
Before PyMongoExplain, one would need to convert the update_one into the equivalent MongoDB command::
21+
22+
collection.database.command(SON([('explain', SON([('update', 'products'), ('updates', [{'q': {'quantity': 1057, 'category': 'apparel'}, 'upsert': False, 'multi': False, 'u': {'$set': {'reorder': True}}}])])), ('verbosity', 'queryPlanner')]))
23+
24+
25+
After PyMongoExplain::
26+
27+
ExplainCollection(collection).update_one({"quantity": 1057, "category": "apparel"},{"$set": {"reorder": True}})
28+
1429
.. _explained: https://docs.mongodb.com/master/reference/command/explain/#dbcmd.explain.
1530

1631
Installation
1732
============
1833

19-
To install this package simply use pip: ::
34+
To install this package simply use pip::
2035

2136
pip install pymongoexplain
2237

@@ -110,7 +125,7 @@ Explaining commands in a script
110125
-------------------------------
111126

112127
You can also run explain on all commands within a Python script using our CLI tool.
113-
Given a script that contains ``pymongo`` commands within it, you can simply run: ::
128+
Given a script that contains ``pymongo`` commands within it, you can simply run::
114129

115130
python3 -m pymongoexplain <path/to/your/script.py>
116131

0 commit comments

Comments
 (0)