Package: python-mong0
Info:Seethe mongo sitefor more information. SeeGitHubfor the latest source.Documentation:Available atpymongo.readthedocs.ioAuthor:The MongoDB Python TeamAboutThe PyMongo distribution contains tools for interacting with MongoDB
database from Python.  Thebsonpackage is an implementation of
theBSON formatfor Python. Thepymongopackage is a native Python driver for MongoDB. Thegridfspackage
is agridfsimplementation on top ofpymongo.PyMongo supports MongoDB 3.6, 4.0, 4.2, 4.4, and 5.0.Support / FeedbackFor issues with, questions about, or feedback for PyMongo, please look into
oursupport channels. Please
do not email any of the PyMongo developers directly with issues or
questions - you’re more likely to get an answer on theMongoDB Community
Forums.Bugs / Feature RequestsThink you鈥檝e found a bug? Want to see a new feature in PyMongo? Please open a
case in our issue management tool, JIRA:Create an account and login.Navigate tothe PYTHON project.ClickCreate 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 arepublic.How To Ask For HelpPlease 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 VulnerabilitiesIf you鈥檝e identified a security vulnerability in a driver or any other
MongoDB project, please report it according to theinstructions here.InstallationPyMongo can be installed withpip:$ python -m pip install pymongoOreasy_installfromsetuptools:$ python -m easy_install pymongoYou can also download the project source and do:$ python setup.py installDonotinstall 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.DependenciesPyMongo supports CPython 3.7+ and PyPy3.7+.Optional dependencies:GSSAPI authentication requirespykerberoson Unix orWinKerberoson Windows. The correct
dependency can be installed automatically along with PyMongo:$ python -m pip install "pymongo[gssapi]"MONGODB-AWS authentication requirespymongo-auth-aws:$ python -m pip install "pymongo[aws]"Support for mongodb+srv:// URIs requiresdnspython:$ python -m pip install "pymongo[srv]"OCSP (Online Certificate Status Protocol) requiresPyOpenSSL,requests,service_identityand may
requirecertifi:$ python -m pip install "pymongo[ocsp]"Wire protocol compression with snappy requirespython-snappy:$ python -m pip install "pymongo[snappy]"Wire protocol compression with zstandard requireszstandard:$ python -m pip install "pymongo[zstd]"Client-Side Field Level Encryption requirespymongocrypt:$ python -m pip install "pymongo[encryption]"You can install all dependencies automatically with the following
command:$ python -m pip install "pymongo[gssapi,aws,ocsp,snappy,srv,tls,zstd,encryption]"Additional dependencies are:(to generate documentation)sphinxExamplesHere’s a basic example (for more see theexamplessection of the docs):>>>importpymongo>>>client=pymongo.MongoClient("localhost",27017)>>>db=client.test>>>db.name'test'>>>db.my_collectionCollection(Database(MongoClient('localhost',27017),'test'),'my_collection')>>>db.my_collection.insert_one({"x":10}).inserted_idObjectId('4aba15ebe23f6b53b0000000')>>>db.my_collection.insert_one({"x":8}).inserted_idObjectId('4aba160ee23f6b543e000000')>>>db.my_collection.insert_one({"x":11}).inserted_idObjectId('4aba160ee23f6b543e000002')>>>db.my_collection.find_one(){'x':10,'_id':ObjectId('4aba15ebe23f6b53b0000000')}>>>foritemindb.my_collection.find():...print(item["x"])...10811>>>db.my_collection.create_index("x")'x_1'>>>foritemindb.my_collection.find().sort("x",pymongo.ASCENDING):...print(item["x"])...81011>>>[item["x"]foritemindb.my_collection.find().limit(2).skip(1)][8,11]DocumentationDocumentation is available atpymongo.readthedocs.io.To build the documentation, you will need to installsphinx.
Documentation can be generated by runningpython
setup.py doc. Generated documentation can be found in thedoc/build/html/directory.TestingThe easiest way to run the tests is to runpython setup.py testin
the root of the distribution.To verify that PyMongo works with Gevent’s monkey-patching:$ python green_framework_test.py geventOr with Eventlet’s:$ python green_framework_test.py eventlet