Skip to content

Commit c0526a9

Browse files
authored
Add boilerplate information to README (#20)
1 parent 0f16387 commit c0526a9

File tree

1 file changed

+86
-29
lines changed

1 file changed

+86
-29
lines changed

README.rst

Lines changed: 86 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,71 @@
1-
This package provides an ``ExplainCollection`` class
2-
that allows that allows PyMongo's Collection methods to be explained_
1+
==============
2+
PyMongoExplain
3+
==============
4+
5+
:Info: Explain collections in PyMongo. See
6+
`GitHub <https://github.com/mongodb-labs/pymongoexplain>`_
7+
for the latest source.
8+
:Author: Julius Park
9+
10+
About
11+
=====
12+
This package provides an ``ExplainCollection`` class that allows PyMongo's Collection methods to be explained_
313

414
.. _explained: https://docs.mongodb.com/master/reference/command/explain/#dbcmd.explain.
515

16+
Installation
17+
============
18+
19+
To install this package simply use pip: ::
20+
21+
pip install pymongoexplain
22+
23+
Support / Feedback
24+
==================
25+
26+
For questions, discussions, or general technical support, visit the MongoDB Community Forums.
27+
The MongoDB Community Forums are a centralized place to connect with other MongoDB users, ask questions, and get answers.
28+
29+
Bugs / Feature Requests
30+
=======================
31+
32+
Think you’ve found a bug? Want to see a new feature in PyMongoExplain?
33+
Please open an issue on this GitHub repository.
34+
35+
How To Ask For Help
36+
-------------------
37+
38+
Please include all of the following information when opening an issue:
39+
40+
- Detailed steps to reproduce the problem, including full traceback, if possible.
41+
- The exact python version used, with patch level::
42+
43+
$ python -c "import sys; print(sys.version)"
44+
45+
- The exact version of PyMongo used (if applicable), with patch level::
46+
47+
$ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
48+
49+
- The exact version of PyMongoExplain used::
50+
51+
$ python -c "import pymongoexplain; print(pymongoexplain.version)"
52+
53+
54+
Dependencies
55+
============
56+
57+
PyMongoExplain requires CPython 3.5+, and PyPy3.5+.
58+
59+
PyMongoExplain requires `PyMongo>=3.10,<4 <https://github.com/mongodb/mongo-python-driver/>`_
60+
61+
Testing
62+
=======
63+
64+
The easiest way to run the tests is to run **python setup.py test** in
65+
the root of the distribution.
666

767
Tutorial
8-
########
68+
========
969

1070
PyMongo operations in existing application code can be explained by swapping ``Collection`` objects with ``ExplainCollection``
1171
objects. The ``ExplainCollection`` class provides all CRUD API methods provided by PyMongo's ``Collection``,
@@ -22,37 +82,32 @@ Now you are ready to explain some commands. Remember that explaining a command d
2282

2383
Now ``result`` will contain the output of running explain on the given ``update_one`` command::
2484

25-
{'$clusterTime':
26-
{'signature': {
27-
'keyId': 0, 'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'},
28-
'clusterTime': Timestamp(1595603051, 3)},
29-
'serverInfo': {'host': 'Juliuss-MBP.verizon.net', 'version': '4.4.0-rc13', 'port': 27017, 'gitVersion': '27f5c1ee9f513f29fe30b8ebefed99581428c6e1'},
30-
'queryPlanner':
31-
{'plannerVersion': 1,
32-
'queryHash': 'CD8F6D8F',
33-
'parsedQuery':
34-
{'$and': [
35-
{'category': {'$eq': 'apparel'}},
36-
{'quantity': {'$eq': 1057}}]},
37-
'namespace': 'db.products',
38-
'indexFilterSet': False,
39-
'winningPlan':
40-
{'inputStage':
41-
{'filter':
42-
{'$and': [
43-
{'category': {'$eq': 'apparel'}},
44-
{'quantity': {'$eq': 1057}}]},
45-
'stage': 'COLLSCAN', 'direction': 'forward'},
46-
'stage': 'UPDATE'}, 'planCacheKey': 'CD8F6D8F',
47-
'rejectedPlans': []}, 'ok': 1.0,
48-
'operationTime': Timestamp(1595603051, 3)}
85+
{'ok': 1.0,
86+
'operationTime': Timestamp(1595603051, 3),
87+
'queryPlanner': {'indexFilterSet': False,
88+
'namespace': 'db.products',
89+
'parsedQuery': {'$and': [{'category': {'$eq': 'apparel'}},
90+
{'quantity': {'$eq': 1057}}]},
91+
'planCacheKey': 'CD8F6D8F',
92+
'plannerVersion': 1,
93+
'queryHash': 'CD8F6D8F',
94+
'rejectedPlans': [],
95+
'winningPlan': {'inputStage': {'direction': 'forward',
96+
'filter': {'$and': [{'category': {'$eq': 'apparel'}},
97+
{'quantity': {'$eq': 1057}}]},
98+
'stage': 'COLLSCAN'},
99+
'stage': 'UPDATE'}},
100+
'serverInfo': {'gitVersion': '27f5c1ee9f513f29fe30b8ebefed99581428c6e1',
101+
'host': 'Juliuss-MBP.verizon.net',
102+
'port': 27017,
103+
'version': '4.4.0-rc13'}}
49104

50105

51106
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.
52107

53108

54109
Explaining commands in a script
55-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110+
-------------------------------
56111

57112
You can also run explain on all commands within a Python script using our CLI tool.
58113
Given a script that contains ``pymongo`` commands within it, you can simply run: ::
@@ -65,4 +120,6 @@ within that script, in addition to running the script itself.
65120
Any positional parameters or arguments required by your script can be
66121
simply be appended to the invocation as follows::
67122

68-
python3 -m pymongoexplain <path/to/your/script.py> [PARAMS] [--optname OPTS]
123+
python3 -m pymongoexplain <path/to/your/script.py> [PARAMS] [--optname OPTS]
124+
125+

0 commit comments

Comments
 (0)