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

supported. compatible. anything incompatible will be fixed: Supported
unsupported. minor incompatibilities may exist: Minor incompatibility
unsupported. incompatible: Unsupported

MongoDB Compatibility

        MongoDB Version
    2.4 2.6 3.0
  2.2 Unsupported Unsupported Unsupported
  2.3 Minor incompatibility Minor incompatibility Minor incompatibility
  2.4 Minor incompatibility Minor incompatibility Minor incompatibility
  2.5 Supported Minor incompatibility Minor incompatibility
  2.6 Supported Minor incompatibility Minor incompatibility
  2.7 Supported Supported Minor incompatibility
  2.8 Supported Supported Supported
Driver Version 3.0 Supported Supported Supported

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 Supported Supported Supported Supported Supported Supported Minor incompatibility Minor incompatibility Minor incompatibility
  2.3 Supported Supported Supported Supported Supported Supported Minor incompatibility Minor incompatibility Minor incompatibility
  2.4 Supported Supported Supported Supported Supported Supported Supported Minor incompatibility Minor incompatibility
  2.5 Supported Supported Supported Supported Supported Supported Minor incompatibility Minor incompatibility Minor incompatibility
  2.6 Supported Supported Supported Supported Supported Supported Supported Supported Minor incompatibility
  2.7 Supported Supported Supported Supported Supported Supported Supported Supported Minor incompatibility
  2.8 Supported Supported Supported Supported Supported Supported Supported Supported Minor incompatibility
Driver Version 3.0 Unsupported Unsupported Supported Supported Unsupported Supported Supported Supported Minor incompatibility

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

supported. compatible. anything incompatible will be fixed: Supported
unsupported. minor incompatibilities may exist: Minor incompatibility
unsupported. incompatible: Unsupported

MongoDB Compatibility

        MongoDB Version
    2.4 2.6 3.0
  0.1 (wraps PyMongo 2.5.0) Supported Minor incompatibility Minor incompatibility
  0.2 (wraps PyMongo 2.7.0) Supported Supported Minor incompatibility
  0.3 (wraps PyMongo 2.7.1) Supported Supported Minor incompatibility
Driver Version 0.4 (wraps PyMongo 2.8) Supported Supported Supported

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) Supported Supported Supported Minor incompatibility Minor incompatibility Supported Minor incompatibility Minor incompatibility
  0.2 (wraps PyMongo 2.7.0) Unsupported Supported Supported Minor incompatibility Minor incompatibility Supported Minor incompatibility Minor incompatibility
  0.3 (wraps PyMongo 2.7.1) Unsupported Supported Supported Minor incompatibility Minor incompatibility Supported Supported Minor incompatibility
Driver Version 0.4 Unsupported Supported Supported Minor incompatibility Minor incompatibility Supported Supported Minor incompatibility

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