OPTIONS

Python MongoDB Drivers

This is an overview of the available tools for using Python with MongoDB. Those wishing to skip to more detailed discussion should check out the Python Driver Tutorial.

Python Driver

PyMongo is the recommended way to work with MongoDB from Python.

Python Driver Compatibility

MongoDB Compatibility

The following compatibility table specifies the recommended version(s) of the MongoDB Python driver for use with a specific version of MongoDB.

The first column lists the driver version(s).

Python Driver MongoDB 2.4 MongoDB 2.6 MongoDB 3.0
3.0
2.8

For additional driver versions, see Python Driver MongoDB Compatibility Reference.

The driver does not support older versions of MongoDB.

Language Compatibility

The following compatibility table specifies the recommended version(s) of the MongoDB Python driver for use with a specific version of Python.

The first column lists the driver version(s).

Python Driver Python 2.4 Python 2.5, Jython 2.5 Python 2.6 Python 2.7, PyPy Python 3.1 Python 3.2, PyPy3 Python 3.3 Python 3.4
3.0      
2.8

For additional driver versions, see Python Driver Language Compatibility Reference.

Note

  • Jython 2.5 is a Python 2.5-compatible alternative interpreter.
  • PyPy is a Python 2.7 and 3.2-compatible alternative interpreter.

Async Driver

Motor is the recommended asynchronous Python driver for MongoDB and Tornado.

Motor Compatibility

MongoDB Compatibility

The following compatibility table specifies the recommended version(s) of the Motor driver for use with a specific version of Python.

The first column lists the driver version(s).

Motor Driver MongoDB 2.4 MongoDB 2.6 MongoDB 3.0
0.4
0.3  
  • Motor 0.4 wraps PyMongo 2.8
  • Motor 0.3 wraps PyMongo 2.7.1

For additional driver versions, see Motor Driver MongoDB Compatibility Reference.

The driver does not support older versions of MongoDB.

Language Compatibility

The following compatibility table specifies the recommended version(s) of the Motor driver for use with a specific version of Python.

The first column lists the driver version(s).

Motor Driver Python 2.6 Python 2.7 Python 3.1 Python 3.2 Python 3.3 Python 3.4
0.4    
0.3    
  • Motor 0.4 wraps PyMongo 2.8
  • Motor 0.3 wraps PyMongo 2.7.1

For additional driver versions, see Motor Driver Language Compatibility Reference.

Note

  • Motor requires Tornado, and supports the same version of Python as its supported Tornado versions do.
  • PyPy is not supported as it runs Motor code slowly.
  • Motor does not support Jython or Windows.

Python Tools

ORM Like Layers

Because MongoDB is so easy to use the basic Python driver is often the best solution for many applications. However, if you need data validation, associations and other high-level data modeling functionality then ORM like layers may be desired.

Framework Tools

Several tools and adapters for integration with various Python frameworks and libraries also exist.

Alternative drivers

Presentations