Skip to content

Commit 971463a

Browse files
authored
README fixes (#42)
1 parent 92e7264 commit 971463a

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

README.rst

+23-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PyMongoExplain
99

1010
About
1111
=====
12-
This package provides an ``ExplainCollection`` class that allows PyMongo's Collection methods to be explained_
12+
This package provides an ``ExplainableCollection`` class that allows PyMongo's Collection methods to be explained_
1313

1414
PyMongoExplain greatly simplifies the amount of effort needed to explain commands.
1515
For example, suppose we wanted to explain the following ``update_one``::
@@ -24,7 +24,7 @@ Before PyMongoExplain, one would need to convert the update_one into the equival
2424

2525
After PyMongoExplain::
2626

27-
ExplainCollection(collection).update_one({"quantity": 1057, "category": "apparel"},{"$set": {"reorder": True}})
27+
ExplainableCollection(collection).update_one({"quantity": 1057, "category": "apparel"},{"$set": {"reorder": True}})
2828

2929
.. _explained: https://docs.mongodb.com/master/reference/command/explain/#dbcmd.explain.
3030

@@ -38,14 +38,14 @@ To install this package simply use pip::
3838
Support / Feedback
3939
==================
4040

41-
For questions, discussions, or general technical support, visit the MongoDB Community Forums.
41+
For questions, discussions, or general technical support, visit the `MongoDB Community Forums <https://developer.mongodb.com/community/forums/tag/python>`_.
4242
The MongoDB Community Forums are a centralized place to connect with other MongoDB users, ask questions, and get answers.
4343

4444
Bugs / Feature Requests
4545
=======================
4646

4747
Think you’ve found a bug? Want to see a new feature in PyMongoExplain?
48-
Please open an issue on this GitHub repository.
48+
Please open an issue on this `GitHub repository <https://github.com/mongodb-labs/pymongoexplain>`_.
4949

5050
How To Ask For Help
5151
-------------------
@@ -82,14 +82,16 @@ the root of the distribution.
8282
Tutorial
8383
========
8484

85-
PyMongo operations in existing application code can be explained by swapping ``Collection`` objects with ``ExplainCollection``
86-
objects. The ``ExplainCollection`` class provides all CRUD API methods provided by PyMongo's ``Collection``,
85+
PyMongo operations in existing application code can be explained by swapping ``Collection`` objects with ``ExplainableCollection``
86+
objects. The ``ExplainableCollection`` class provides all CRUD API methods provided by PyMongo's ``Collection``,
8787
but using this class to run operations runs explain on them, instead of executing them.
8888

89-
To run explain on a command, first instantiate an ``ExplainCollection`` from the ``Collection`` object originally used to run the command::
89+
To run explain on a command, first instantiate an ``ExplainableCollection`` from the ``Collection`` object originally used to run the command::
90+
91+
from pymongoexplain import ExplainableCollection
9092

9193
collection = client.db.products
92-
explain = ExplainCollection(collection)
94+
explain = ExplainableCollection(collection)
9395

9496
Now you are ready to explain some commands. Remember that explaining a command does not execute it::
9597

@@ -118,7 +120,7 @@ Now ``result`` will contain the output of running explain on the given ``update_
118120
'version': '4.4.0-rc13'}}
119121

120122

121-
Since ``ExplainCollection`` instances provide all the same methods provided by ``Collection`` instances, explaining operations in your application code is a simple matter of replacing ``Collection`` instances in your application code with ``ExplainCollection`` instances.
123+
Since ``ExplainableCollection`` instances provide all the same methods provided by ``Collection`` instances, explaining operations in your application code is a simple matter of replacing ``Collection`` instances in your application code with ``ExplainableCollection`` instances.
122124

123125

124126
Explaining commands in a script
@@ -134,14 +136,23 @@ within the specified script, **in addition to running every command** in the scr
134136
explain output is generated using the `logging <https://docs.python.org/3/library/logging.html>`_ module,
135137
if your script configures logging module there are certain things to keep in mind:
136138

137-
- if your script sets the `logging level <https://docs.python.org/3/library/logging.html#logging-levels>`_
138-
higher than INFO, the explain output will be suppressed entirely.
139+
- if your script sets the `logging level <https://docs.python.org/3/library/logging.html#logging-levels>`_ higher than INFO, the explain output will be suppressed entirely.
139140
- the explain output will be sent to whatever stream your script configures the logging module to send output to.
140141

141-
142142
Any positional parameters or arguments required by your script can be
143143
simply be appended to the invocation as follows::
144144

145145
python3 -m pymongoexplain <path/to/your/script.py> [PARAMS] [--optname OPTS]
146146

147147

148+
Limitations
149+
-----------
150+
151+
This package does not support the fluent `Cursor API <https://pymongo.readthedocs.io/en/stable/api/pymongo/cursor.html>`_,
152+
so if you attempt to use it like so::
153+
154+
ExplainableCollection(collection).find({}).sort(...)
155+
156+
Instead pass all the arguments to the find() call, like so::
157+
158+
ExplainableCollection(collection).find({}, sort=...)

0 commit comments

Comments
 (0)