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 = motor.motor_tornado.MotorClient( "mongodb+srv://<username>:<password>@<cluster-url>/test?retryWrites=true&w=majority") db = client.test
Compatibility¶
MongoDB Compatibility¶
Motor (Python async) Driver | MongoDB 4.4 | MongoDB 4.2 | MongoDB 4.0 | MongoDB 3.6 | MongoDB 3.4 | MongoDB 3.2 | MongoDB 3.0 | MongoDB 2.6 |
---|---|---|---|---|---|---|---|---|
2.3 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
2.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
2.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
2.0 | ✓ | ✓ | ✓ | ✓ | ✓ | |||
1.3 | ✓ | ✓ | ✓ | ✓ | ✓ | |||
1.2 | ✓ | ✓ | ✓ | ✓ | ✓ | |||
1.1 | ✓ | ✓ | ✓ | ✓ | ||||
1.0 | ✓ | ✓ | ✓ | ✓ | ||||
0.7 | ✓ | ✓ | ✓ | |||||
0.6 | ✓ | ✓ | ||||||
0.5 | ✓ | ✓ | ||||||
0.4 | ✓ | ✓ | ||||||
0.3 | ✓ | |||||||
0.2 | ✓ |
- Motor 1.3 wraps PyMongo 3.6+ and adds support for CPython 3.7
- 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) Driver | Python 3.9 | Python 3.8 | Python 3.7 | Python 3.6 | Python 3.5 | Python 3.4 | Python 3.3 | Python 2.7 | Python 2.6 | Python 2.5 |
---|---|---|---|---|---|---|---|---|---|---|
2.3 | ✓ | ✓ | ✓ | ✓ | ✓ | |||||
2.2 | ✓ | ✓ | ✓ | ✓ | ✓ | |||||
2.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
2.0 | ✓ | ✓ | ✓ | ✓ | ✓ | |||||
1.3 | ✓ | ✓ | ✓ | ✓ | ✓ | |||||
1.2 | ✓ | ✓ | ✓ | ✓ | ||||||
1.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
1.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
0.7 | ✓ | ✓ | ✓ | ✓ | ✓ | |||||
0.6 | ✓ | ✓ | ✓ | ✓ | ✓ | |||||
0.5 | ✓ | ✓ | ✓ | ✓ | ✓ | |||||
0.4 | ✓ | ✓ | ✓ | ✓ | ||||||
0.3 | ✓ | ✓ | ✓ | ✓ | ||||||
0.2 | ✓ | ✓ | ✓ | |||||||
0.1 | ✓ | ✓ | ✓ | ✓ |
- Motor 2.3 wraps PyMongo 3.11+
- Motor 2.2 wraps PyMongo 3.11+
- Motor 2.1 wraps PyMongo 3.10+
- Motor 2.0 wraps PyMongo 3.7+
- 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.
- Motor 2.3+ supports Windows.
For more information on how to read the compatibility tables, see our guide on MongoDB Compatibility Tables.
How to get help¶
- Ask questions on our MongoDB Community Forums.
- Visit our Support Channels.
- See JIRA to raise issues or request features.
Give Feedback