Python driver for MongoDB <http://www.mongodb.org>
Project description
- Info:
See the mongo site for more information. See GitHub for the latest source.
- Maintainer:
Bernie Hackett <bernie@mongodb.com>
About
The PyMongo distribution contains tools for interacting with MongoDB database from Python. The bson package is an implementation of the BSON format for Python. The pymongo package is a native Python driver for MongoDB. The gridfs package is a gridfs implementation on top of pymongo.
PyMongo supports MongoDB 2.6, 3.0, 3.2, 3.4, 3.6 and 4.0.
Support / Feedback
For issues with, questions about, or feedback for PyMongo, please look into our support channels. Please do not email any of the PyMongo developers directly with issues or questions - you’re more likely to get an answer on the mongodb-user list on Google Groups.
Bugs / Feature Requests
Think you’ve found a bug? Want to see a new feature in PyMongo? Please open a case in our issue management tool, JIRA:
Navigate to the PYTHON project.
Click Create Issue - Please provide as much information as possible about the issue type and how to reproduce it.
Bug reports in JIRA for all driver projects (i.e. PYTHON, CSHARP, JAVA) and the Core Server (i.e. SERVER) project are public.
How To Ask For Help
Please include all of the following information when opening an issue:
Detailed steps to reproduce the problem, including full traceback, if possible.
The exact python version used, with patch level:
$ python -c "import sys; print(sys.version)"
The exact version of PyMongo used, with patch level:
$ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
The operating system and version (e.g. Windows 7, OSX 10.8, …)
Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, …)
Security Vulnerabilities
If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here.
Installation
PyMongo can be installed with pip:
$ python -m pip install pymongo
Or easy_install from setuptools:
$ python -m easy_install pymongo
You can also download the project source and do:
$ python setup.py install
Do not install the “bson” package from pypi. PyMongo comes with its own bson package; doing “easy_install bson” installs a third-party package that is incompatible with PyMongo.
Dependencies
PyMongo supports CPython 2.6, 2.7, 3.4+, PyPy, and PyPy3.
Optional dependencies:
GSSAPI authentication requires pykerberos on Unix or WinKerberos on Windows. The correct dependency can be installed automatically along with PyMongo:
$ python -m pip install pymongo[gssapi]
Support for mongodb+srv:// URIs requires dnspython:
$ python -m pip install pymongo[srv]
TLS / SSL support may require ipaddress and certifi or wincertstore depending on the Python version in use. The necessary dependencies can be installed along with PyMongo:
$ python -m pip install pymongo[tls]
Wire protocol compression with snappy requires python-snappy:
$ python -m pip install pymongo[snappy]
You can install all dependencies automatically with the following command:
$ python -m pip install pymongo[snappy,gssapi,srv,tls]
Other optional packages:
backports.pbkdf2, improves authentication performance with SCRAM-SHA-1 and SCRAM-SHA-256. It especially improves performance on Python versions older than 2.7.8.
monotonic adds support for a monotonic clock, which improves reliability in environments where clock adjustments are frequent. Not needed in Python 3.
Additional dependencies are:
Examples
Here’s a basic example (for more see the examples section of the docs):
>>> import pymongo
>>> client = pymongo.MongoClient("localhost", 27017)
>>> db = client.test
>>> db.name
u'test'
>>> db.my_collection
Collection(Database(MongoClient('localhost', 27017), u'test'), u'my_collection')
>>> db.my_collection.insert_one({"x": 10}).inserted_id
ObjectId('4aba15ebe23f6b53b0000000')
>>> db.my_collection.insert_one({"x": 8}).inserted_id
ObjectId('4aba160ee23f6b543e000000')
>>> db.my_collection.insert_one({"x": 11}).inserted_id
ObjectId('4aba160ee23f6b543e000002')
>>> db.my_collection.find_one()
{u'x': 10, u'_id': ObjectId('4aba15ebe23f6b53b0000000')}
>>> for item in db.my_collection.find():
... print(item["x"])
...
10
8
11
>>> db.my_collection.create_index("x")
u'x_1'
>>> for item in db.my_collection.find().sort("x", pymongo.ASCENDING):
... print(item["x"])
...
8
10
11
>>> [item["x"] for item in db.my_collection.find().limit(2).skip(1)]
[8, 11]
Documentation
You will need sphinx installed to generate the documentation. Documentation can be generated by running python setup.py doc. Generated documentation can be found in the doc/build/html/ directory.
Testing
The easiest way to run the tests is to run python setup.py test in the root of the distribution. Note that you will need unittest2 to run the tests under Python 2.6.
To verify that PyMongo works with Gevent’s monkey-patching:
$ python green_framework_test.py gevent
Or with Eventlet’s:
$ python green_framework_test.py eventlet
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pymongo-3.7.1-py3.7-win-amd64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6192bf37933d16d5348e9d7ca6f3b2a45fbafe110ac77460e67dc856913d1b2f |
|
MD5 | afcd639981efe708c5e9f3402521ff66 |
|
BLAKE2b-256 | 8f4ac169f45a194fa840bf0d7f9ad6d04227597d0dc139ca65607b480612eca6 |
Hashes for pymongo-3.7.1-py3.7-macosx-10.6-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 847c8ce15a1b5634c7a62732899f339d168a443115cd9bc37c52d75fb362bca1 |
|
MD5 | 0d4c0dd129bab8a5ed941637b8e7c06e |
|
BLAKE2b-256 | 7f727ffea6234a913fb3b95940eb70634b745aa2cbbf79e930b79f925c67107f |
Hashes for pymongo-3.7.1-py3.6-win-amd64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c1436e9b65fd2c0c46141cef108cae8cd303c0d233af7c0e0de18b3c59c6dcf |
|
MD5 | 221f408007887ae9266e7c7585a8bdda |
|
BLAKE2b-256 | 040fc521f837b94080144df44b5c770350b115864c76745a441c2f0af79f6e04 |
Hashes for pymongo-3.7.1-py3.6-macosx-10.6-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9a6b224362bbdfc3e18fcb03c449422bf3a826b7365a77fcd863bcdef020b7c |
|
MD5 | b44d757e14d0ddfeded34d53eb30975b |
|
BLAKE2b-256 | ca6d5d115927116ee05493d282f2cd0079920b1ee330db230bdf7680a73f77a7 |
Hashes for pymongo-3.7.1-py3.5-win-amd64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 457faf75fc9e8c25625240436508c4e482f977a31363a84a9a25fabb4b8a2194 |
|
MD5 | 2fc72b09b2575d7d703be7d631f11c4b |
|
BLAKE2b-256 | 069bee21ad7709a75659ff53ade1e9b19d7f2ae479a57068350c69f99c0ccd0a |
Hashes for pymongo-3.7.1-py3.5-macosx-10.6-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4b348c2f51cb1bd75a31f3fc53eee59975ff7349def12f8f6e2d6cc198e849a |
|
MD5 | 4ed400e9af94b58a4f46fbf95fb39934 |
|
BLAKE2b-256 | b80bfdd7ab795cf80940475322a98fea07dc62a7139670c6e32c64b175b01812 |
Hashes for pymongo-3.7.1-py3.4-win-amd64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34bb6b32969677d7f6a9694945899c5c9324d93094874b5fe9c0a4aa10323a49 |
|
MD5 | 0da7821cd5cb30bfdbbb94529fdfc3a8 |
|
BLAKE2b-256 | 0959da6e98886a7234603ce9cae9ebcef589f797542b12009cfe0b4db413a94a |
Hashes for pymongo-3.7.1-py3.4-macosx-10.6-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75183c8336e25b4b879dc8fc8d13a585abb5e0042d0ddbd4b54fb36c11f849bf |
|
MD5 | 9274f1613724f7516d9e1ff329f4c072 |
|
BLAKE2b-256 | 9a7616304e9c6716b4589003fb680bf6735328a5a9a02e540d84f9d4ba768e01 |
Hashes for pymongo-3.7.1-py2.7-win-amd64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f6cac26ed5aaf811e6310d5829506eee7f0c5f113fd5a5c2bd4c584d6a994f |
|
MD5 | e3571eb2153b1c727b08356ab37a5543 |
|
BLAKE2b-256 | dc41a4d8ea9b0dc1a7f618f42ff6aa74732ba0e6dac5175e35f7fa1e13c222d2 |
Hashes for pymongo-3.7.1-py2.7-macosx-10.13-intel.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69d757cc9786e1417cc44230073c82e490f8f5c4a71299de7dba8fbce7193f8f |
|
MD5 | e3de7d54e68ec0c859a1c40298484798 |
|
BLAKE2b-256 | b177ceda474f459dc0a90c577339ddb210713fbb45d4f259aa6d4d5df499e6c0 |
Hashes for pymongo-3.7.1-py2.6-win-amd64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 075686718e64483b95abf224317925687742e810dbf95d5750c8fb36cf88a5ec |
|
MD5 | 62d6b6d082da7f3f60c691cda4911edd |
|
BLAKE2b-256 | 773b6d7f05af2d5b8973256c734384de0519f2988fef4893e54069e297a1a272 |
Hashes for pymongo-3.7.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8330406f294df118399c721f80979f2516447bcc73e4262826687872c864751e |
|
MD5 | cfbb6af983357e9ff113f294d9acf6e3 |
|
BLAKE2b-256 | 25dc3857a6e7669e25d90fea3e16c088417c5d6f7cda85352e89c3beb3053524 |
Hashes for pymongo-3.7.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dab0f63841aebb2b421fadb31f3c7eef27898f21274a8e5b45c4f2bccb40f9ed |
|
MD5 | 6d7ff98494ea1a762f33e7086f7761ca |
|
BLAKE2b-256 | 242b41bbefdca46f79ab842fbb3388c4d27512a474c3610884d1ea69e9aa269e |
Hashes for pymongo-3.7.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f16c7b6b98bc400d180f05e65e2236ef4ee9d71f3815280558582670e1e67536 |
|
MD5 | ff85397ba7e0b1966b5f0e1d8e71a0e0 |
|
BLAKE2b-256 | 49da5ddfc781dc566e7d931eb73f6f31d7d410384c5b1d9c077aa40c8360f369 |
Hashes for pymongo-3.7.1-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2d9eb92b26600ae6e8092f66da4bcede1b61a647c9080d6b44c148aff3a8ea4 |
|
MD5 | 07607acad0d945b068063b00bdc11b1c |
|
BLAKE2b-256 | da5e8c49f3b3ffa25e5740bf4939226e4ce968de3671e9eeb68ec16a0e13c959 |
Hashes for pymongo-3.7.1-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7ad1ec621db2c5ad47924f63561f75abfd4fff669c62c8cc99c169c90432f59 |
|
MD5 | a8034f616fb8615e8cf2f9eb7ff4dae7 |
|
BLAKE2b-256 | 0ea61fd58307975e1ca888533337a4d5929c6f15bea4cfeda13f6b5b050158c6 |
Hashes for pymongo-3.7.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fa4303e1f50d9f0c8f2f7833b5a370a94d19d41449def62b34ae072126b4dfd |
|
MD5 | 986d78f882c5bd8ee5c78959344efdca |
|
BLAKE2b-256 | b28e7171a56414354a4cb0862c9f2bde057c26f7cd0f28f982a3892fa0be5a89 |
Hashes for pymongo-3.7.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b5a3806d9f656c14e9d9b693a344fc5684fdd045155594be0c505c6e9410a94 |
|
MD5 | 9b3a0bfff16325e94344fe601e2c13ed |
|
BLAKE2b-256 | 28eeb5f807d821597c0b67689d3947a668efa5611c00714302465805ec021934 |
Hashes for pymongo-3.7.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6613e633676168a4500e5e6bb6e3e64d3fdb96d2dc472eb4b99235fb4141adb1 |
|
MD5 | 31aa54862641182c3517d06066a5d84b |
|
BLAKE2b-256 | 1188dd1f8c4281a60791b043f55e338d0521049208f21e3de19ddc9c160dbbef |
Hashes for pymongo-3.7.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ce2a71f473f4703daa8d6c61a00b35ce625a7f5015b4371e3af728dafca296a |
|
MD5 | ea23eb49a5598247aaaa2741ebeae110 |
|
BLAKE2b-256 | b347373ac7f49f9285b9346a27925f73bff5267144224cf8f49135eb6a7a9ec1 |
Hashes for pymongo-3.7.1-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0949110db76eb1b54cecfc0c0f8468a8b9a7fd42ba23fd0d4a37d97e0b4ca203 |
|
MD5 | adc00bd3c66da87a6a4e852480d4bdfa |
|
BLAKE2b-256 | 22696f8358c6bbca32f1c94167ccab217bc6a70d17bdb10d4a71f4de96431e6e |
Hashes for pymongo-3.7.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b73f889f032fbef05863f5056b46468a8262ae83628898e20b10bbbb79a3617e |
|
MD5 | 73cc7aed7f8e0a1cd2b3ed8ed7ecda8a |
|
BLAKE2b-256 | b52de537971ac8beb0e3279e483c3e4dd817b93c0355c341f4cd622b00ec2003 |
Hashes for pymongo-3.7.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffe94f9d17800610dda5282d7f6facfc216d79a93dd728a03d2f21cff3af7cc6 |
|
MD5 | 9548c3d3640bdd9255a86b582007109f |
|
BLAKE2b-256 | 9f0df54b6d58209a313b279a0951921dcc4591788b01910a42066a22a0c7fc87 |
Hashes for pymongo-3.7.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08dea6dbff33363419af7af3bf2e9a373ff71eb22833dd7063f9b953f09a0bdf |
|
MD5 | 1732fa9bb89e4b7957e695f09791e3c5 |
|
BLAKE2b-256 | 30ced16d7ca2dbea3c0b945365961a59e069f25660a80e10cfb1a8c6cbb03a10 |
Hashes for pymongo-3.7.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b752088a2f819f163d11dfdbbe627b27eef9d8478c7e57d42c5e7c600fee434e |
|
MD5 | 520972fc258ed1329f866459c4c34c72 |
|
BLAKE2b-256 | 99def25810448cd10500328a50bf5b6463e51efe2986a07aa8452c5a2348466b |
Hashes for pymongo-3.7.1-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e10b3fda5677d360440ebd12a1185944dc81d9ea9acf0c6b0681013b3fb9bc2 |
|
MD5 | 7322480afe3a625f33dbc676be16c06e |
|
BLAKE2b-256 | 126e69f293569703034a24b275824c0b08d87bb284a3917377ba5bb6d8c0612e |
Hashes for pymongo-3.7.1-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccf00549efaf6f8d5b35b654beb9aed2b788a5b33b05606eb818ddaa4e924ea3 |
|
MD5 | 721f50e5c6ecd49527e4d4d18209d03d |
|
BLAKE2b-256 | d42d45524c8cc77b843ace9d75be604e0aba7efd4113effcb504d22de4613845 |
Hashes for pymongo-3.7.1-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cb50541225208b37786fdb0de632e475c4f00ec4792579df551ef48d6999d69 |
|
MD5 | 8a735b47bfae60b7f5bfcae017492958 |
|
BLAKE2b-256 | 33e1bdbe13aad23acda1696c2da91d4a3a7389748f749e16f65837017e87084b |
Hashes for pymongo-3.7.1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d776d8d47884e6ad39ff8a301f1ae6b7d2186f209218cf024f43334dbba79c64 |
|
MD5 | a0547ed73ea1f0d2788512a2f1936593 |
|
BLAKE2b-256 | 7d3cae27607ff0f19d174c7c9b95f35e52f263cc0d25c0f21da802837bb83bee |
Hashes for pymongo-3.7.1-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52999666ad01de885653e1f74a86c2a6520d1004afec475180bebf3d7393a8fc |
|
MD5 | 2f718d3e74840554058074b6203c793e |
|
BLAKE2b-256 | e6453e34c792e3ba8eb189da8c88985a324f2f4063be771fc4aa44bbff9462e0 |
Hashes for pymongo-3.7.1-cp34-cp34m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 562c353079e8ce7e2ad611fd7436a72f5df97be72bca59ae9ebf789a724afd5c |
|
MD5 | cc23bb3446cade82c37fb331556ddb80 |
|
BLAKE2b-256 | 6c19100d2e0c2a125b46fcf970a208c3c58a95844380b3c1656c9a8f42dbdc85 |
Hashes for pymongo-3.7.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8669f96277f140797e0ff99f80bd706271674942672a38ed694e2bfa66f3900 |
|
MD5 | abe36b9b266191ef03f6c085f38e60cc |
|
BLAKE2b-256 | e6c12bc5fab47fbe48ad1238031d808854bf8726ad62835ffedaec63ba9227ea |
Hashes for pymongo-3.7.1-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e939dfa7d16609b99eb4d1fd2fc74f7a90f4fd0aaf31d611822daaff456236f |
|
MD5 | 1bf29d68086951e3e26c3a326fea141e |
|
BLAKE2b-256 | a0bfbfeac82c61118a120cbd7ab95ba616f5520ddf61a9d3fa3d1bfa19653343 |
Hashes for pymongo-3.7.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a14e2d7c2c0e07b5affcfbfc5c395d767f94bb1a822934a41a3b5371cde1458 |
|
MD5 | 6b54343f7cdfe5a5384d2b463429b18c |
|
BLAKE2b-256 | d6db32069c0dcc8d5abd0c81acbf930c938409cf5793a870bac3ca51de7f9b39 |
Hashes for pymongo-3.7.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce7c91463ad21ac72fc795188292b01c8366cf625e2d1e5ed473ce127b844f60 |
|
MD5 | 2cc49d711d8e08c0f735fc48716af20f |
|
BLAKE2b-256 | a87f67894e065ebf86b046cf3c560b44abab8ca99f264d9162ee9aad838835f7 |
Hashes for pymongo-3.7.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 966d987975aa3b4cfcdf1495930ff6ecb152fafe8e544e40633e41b24ca3e1c5 |
|
MD5 | f7974400ca0fa1d29ebe5140277bb908 |
|
BLAKE2b-256 | 5d647910bc07cd3cc0b12650db529ccab0b695953232f75f1c1003e94c574315 |
Hashes for pymongo-3.7.1-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | daedcfbf3b24b2b687e35b33252a9315425c2dd06a085a36906d516135bdd60e |
|
MD5 | 12f221bbd1140fcf8b8b284bf443d191 |
|
BLAKE2b-256 | 28f398537260af11271862f0c279d503f8d63e7b629e1cb4cf5ccd539052d8f6 |
Hashes for pymongo-3.7.1-cp27-cp27m-macosx_10_13_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aec4ea43a1b8e9782246a259410f66692f2d3aa0f03c54477e506193b0781cb6 |
|
MD5 | 631cc9988db945ee58e8b62690b18110 |
|
BLAKE2b-256 | a1e051df08036e04c1ddc985a2dceb008f2f21fc1d6de711bb6cee85785c1d78 |
Hashes for pymongo-3.7.1-cp26-cp26m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f59440b993666a417ba1954cfb1b7fb11cb4dea1a1d2777897009f688d000ee |
|
MD5 | af309b43657c4745529051dbeff634ee |
|
BLAKE2b-256 | bf56524fda242f5f9e5d2191231ca1ff37cdf3ab5b91bfb3abf47ab1b276838c |
Hashes for pymongo-3.7.1-cp26-cp26m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c31a39f440801cc8603547ccaacf4cb1f02b81af6ba656621c13677b27f4426 |
|
MD5 | 194581acfd5f28f05a5d7bf912621d6d |
|
BLAKE2b-256 | 53d1e2fe86487b36c5872a3ebfe8260ce8342cdd3bceacdbd5a7e70877a0c383 |