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

compatible: Compatible
untested: Untested
incompatible: Incompatible
unknown: Unknown

MongoDB Compatibility

        MongoDB Version
    2.4 2.6 3.0
  2.2 Incompatible Incompatible Incompatible
  2.3 Untested Untested Untested
  2.4 Untested Untested Untested
  2.5 Compatible Untested Untested
  2.6 Compatible Untested Untested
  2.7 Compatible Compatible Untested
  2.8 Compatible Compatible Compatible
Driver Version 3.0 Compatible Compatible Compatible

Older server versions are unsupported.

Language Compatibility

                    Language Version
    2.4 2.5, Jython 2.5 2.6 2.7, PyPy 3.1 3.2, PyPy3 3.3 (Sept 2012) 3.4 (March 2014) 3.5
  2.2 Compatible Compatible Compatible Compatible Compatible Compatible Untested Untested Untested
  2.3 Compatible Compatible Compatible Compatible Compatible Compatible Untested Untested Untested
  2.4 Compatible Compatible Compatible Compatible Compatible Compatible Compatible Untested Untested
  2.5 Compatible Compatible Compatible Compatible Compatible Compatible Untested Untested Untested
  2.6 Compatible Compatible Compatible Compatible Compatible Compatible Compatible Compatible Untested
  2.7 Compatible Compatible Compatible Compatible Compatible Compatible Compatible Compatible Untested
  2.8 Compatible Compatible Compatible Compatible Compatible Compatible Compatible Compatible Untested
Driver Version 3.0 Incompatible Incompatible Compatible Compatible Incompatible Compatible Compatible Compatible Untested

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

compatible: Compatible
untested: Untested
incompatible: Incompatible
unknown: Unknown

MongoDB Compatibility

        MongoDB Version
    2.4 2.6 3.0
  0.1 (wraps PyMongo 2.5.0) Compatible Untested Untested
  0.2 (wraps PyMongo 2.7.0) Compatible Compatible Untested
  0.3 (wraps PyMongo 2.7.1) Compatible Compatible Untested
Driver Version 0.4 (wraps PyMongo 2.8) Compatible Compatible Compatible

Older server versions are unsupported.

Language Compatibility

                  Language Version
    2.5 2.6 2.7 3.1 3.2 3.3 (Sept 2012) 3.4 (March 2014) 3.5
  0.1 (wraps PyMongo 2.5.0) Compatible Compatible Compatible Untested Untested Compatible Untested Untested
  0.2 (wraps PyMongo 2.7.0) Incompatible Compatible Compatible Untested Untested Compatible Untested Untested
  0.3 (wraps PyMongo 2.7.1) Incompatible Compatible Compatible Untested Untested Compatible Compatible Untested
Driver Version 0.4 Incompatible Compatible Compatible Untested Untested Compatible Compatible Untested

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