Navigation

Motor (Async Driver)

Introduction

Motor (Python async) is the recommended asynchronous Python driver for MongoDB. It is compatible with Tornado and asyncio.

Installation

We recommend using pip to install Motor on all platforms:

$ pip install motor

Connect to MongoDB Atlas

To connect to a MongoDB Atlas cluster, use the Atlas connection string for your cluster:

import motor

client = client = motor.motor_tornado.MotorClient(
   "mongodb+srv://<username>:<password>@<cluster-url>/test?retryWrites=true&w=majority")
db = client.test

Compatibility

MongoDB Compatibility

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

The first column lists the driver version(s).

Motor (Python async) Driver MongoDB 3.6 MongoDB 3.4 MongoDB 3.2 MongoDB 3.0 MongoDB 2.6
1.2
1.1  
1.0  
0.7    
0.6      
0.5      
0.4      
0.3        
0.2        
  • Motor 1.2 wraps PyMongo 3.6+
  • Motor 1.1 wraps PyMongo 3.4+
  • Motor 1.0 wraps PyMongo 3.3+
  • Motor 0.7 wraps PyMongo >=2.9.4 and <3.0
  • Motor 0.6 wraps PyMongo 2.8
  • Motor 0.5 wraps PyMongo 2.8
  • Motor 0.4 wraps PyMongo 2.8
  • Motor 0.3 wraps PyMongo 2.7.1
  • Motor 0.2 wraps PyMongo 2.7.0

The driver does not support older versions of MongoDB.

Language Compatibility

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

The first column lists the driver version(s).

Motor (Python async) Driver Python 2.5 Python 2.6 Python 2.7 Python 3.3 Python 3.4 Python 3.5 Python 3.6
1.2      
1.1  
1.0  
0.7    
0.6    
0.5    
0.4      
0.3      
0.2        
0.1      
  • Motor 1.1 wraps PyMongo 3.4+
  • Motor 1.0 wraps PyMongo 3.3+
  • Motor 0.7 wraps PyMongo >=2.9.4 and <3.0
  • Motor 0.6 wraps PyMongo 2.8
  • Motor 0.5 wraps PyMongo 2.8
  • Motor 0.4 wraps PyMongo 2.8
  • Motor 0.3 wraps PyMongo 2.7.1
  • Motor 0.2 wraps PyMongo 2.7.0
  • Motor 0.1 wraps PyMongo 2.5.0

Note

  • Motor version 0.5 and earlier requires Tornado, and supports the same version of Python as its supported Tornado versions do.
  • For asyncio support, Motor requires Python 3.4+, or Python 3.3 with the asyncio package from PyPI.
  • PyPy is not supported as it runs Motor code slowly.
  • Motor does not support Jython or Windows.

How to get help