skip to navigation
skip to content

pymongo3 1.9b1

Python driver for MongoDB <>

Latest Version: Unknown


DEPRECATED - DO NOT USE – The official pymongo driver has reached Python 3.x compatibility in version 2.2, so do not use this port any more.

This is a semi-official port of PyMongo 1.9+ to Python 3.x. Semantics are mostly compatible with the official PyMongo branch, except for a few things listed in the next section. This port can currently only be used on Python 3.1 or later. Compatibility with Python 2.6+ may be added in the future.

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.

About the Py3K port

Byte strings and unicode strings were clearly separated in Python 3. PyMongo3 adapts to these changes by decoding Binary of subtype 0 to the “bytes” type. There has been considerable effort to make things work the way developers would expect them to, with regards to the new semantics of Python 3. If you feel that the new semantics don’t match your expectations, feel free to ask on the mailing list or create a new issue on github (see the next section for that).

Issues / Questions / Feedback

Any issues with, questions about, or feedback for PyMongo3 should be sent to the mongodb-user list on Google Groups. For confirmed issues or feature requests, open a case on github. Please do not e-mail any of the PyMongo developers directly with issues or questions - you’re more likely to get an answer on the list.


If you have distribute installed you should be able to do easy_install pymongo3 to install PyMongo. Otherwise you can download the project source and do python install to install.


The PyMongo3 distribution is supported and tested on Python 3.x, where x >= 1.

Additional dependencies are:

  • (to generate documentation) sphinx
  • (to auto-discover tests) nose


Here’s a basic example (for more see the examples section of the docs):

>>> import pymongo
>>> connection = pymongo.Connection("localhost", 27017)
>>> db = connection.test
>>> db.my_collection
Collection(Database(Connection('localhost', 27017), 'test'), 'my_collection')
>>>{"x": 10})
>>>{"x": 8})
>>>{"x": 11})
>>> db.my_collection.find_one()
{'x': 10, '_id': ObjectId('4aba15ebe23f6b53b0000000')}
>>> for item in db.my_collection.find():
...     print item["x"]
>>> db.my_collection.create_index("x")
>>> for item in db.my_collection.find().sort("x", pymongo.ASCENDING):
...     print item["x"]
>>> [item["x"] for item in db.my_collection.find().limit(2).skip(1)]
[8, 11]


You will need sphinx installed to generate the documentation. Documentation can be generated by running python doc. Generated documentation can be found in the doc/build/html/ directory.


The easiest way to run the tests is to install the Python 3.x compatible fork of nosetests, nose3 and run nosetests3 or python test in the root of the distribution. Tests are located in the test/ directory.

File Type Py Version Uploaded on Size
pymongo3-1.9b1.tar.gz (md5) Source 2010-12-11 148KB (md5) MS Windows installer 3.1 2010-12-16 333KB (md5) MS Windows installer 3.2 2011-03-13 333KB
pymongo3-1.9b1.win32-py3.1.exe (md5) MS Windows installer 3.1 2010-12-16 303KB
pymongo3-1.9b1.win32-py3.2.exe (md5) MS Windows installer 3.2 2011-03-13 303KB
  • Downloads (All Versions):
  • 3 downloads in the last day
  • 69 downloads in the last week
  • 376 downloads in the last month