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

Motor (Python async) DriverMongoDB 3.6MongoDB 3.4MongoDB 3.2MongoDB 3.0MongoDB 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

Motor (Python async) DriverPython 2.5Python 2.6Python 2.7Python 3.3Python 3.4Python 3.5Python 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