Skip to main content

Non-blocking MongoDB driver for Tornado or asyncio

Project description

Motor

PyPI Version Python Versions Monthly Downloads Documentation Status

image

[!WARNING] Motor will be deprecated on May 14th, 2026, one year after the production release of the PyMongo Async driver. Critical bug fixes will be made until May 14th, 2027. We strongly recommend that Motor users migrate to the PyMongo Async driver while Motor is still supported. To learn more, see the migration guide: https://www.mongodb.com/docs/languages/python/pymongo-driver/current/reference/migration/.

About

Motor is a full-featured, non-blocking MongoDB driver for Python asyncio and Tornado applications. Motor presents a coroutine-based API for non-blocking access to MongoDB.

"We use Motor in high throughput environments, processing tens of thousands of requests per second. It allows us to take full advantage of modern hardware, ensuring we utilise the entire capacity of our purchased CPUs. This helps us be more efficient with computing power, compute spend and minimises the environmental impact of our infrastructure as a result."

--David Mytton, Server Density

"We develop easy-to-use sensors and sensor systems with open source software to ensure every innovator, from school child to laboratory researcher, has the same opportunity to create. We integrate Motor into our software to guarantee massively scalable sensor systems for everyone."

--Ryan Smith, inXus Interactive

Support / Feedback

For issues with, questions about, or feedback for PyMongo, please look into our support channels. Please do not email any of the Motor developers directly with issues or questions - you're more likely to get an answer on the StackOverflow (using a "mongodb" tag).

Bugs / Feature Requests

Think you've found a bug? Want to see a new feature in Motor? Please open a case in our issue management tool, JIRA:

Bug reports in JIRA for all driver projects (i.e. MOTOR, CSHARP, JAVA) and the Core Server (i.e. SERVER) project are public.

How To Ask For Help

Please include all of the following information when opening an issue:

  • Detailed steps to reproduce the problem, including full traceback, if possible.

  • The exact python version used, with patch level:

python -c "import sys; print(sys.version)"
  • The exact version of Motor used, with patch level:
python -c "import motor; print(motor.version)"
  • The exact version of PyMongo used, with patch level:
python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
  • The exact Tornado version, if you are using Tornado:
python -c "import tornado; print(tornado.version)"
  • The operating system and version (e.g. RedHat Enterprise Linux 6.4, OSX 10.9.5, ...)

Security Vulnerabilities

If you've identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here.

Installation

Motor can be installed with pip:

pip install motor

Dependencies

Motor works in all the environments officially supported by Tornado or by asyncio. It requires:

  • Unix (including macOS) or Windows.
  • PyMongo >=4.9,<5
  • Python 3.9+

Optional dependencies:

Motor supports same optional dependencies as PyMongo. Required dependencies can be installed along with Motor.

GSSAPI authentication requires gssapi extra dependency. The correct dependency can be installed automatically along with Motor:

pip install "motor[gssapi]"

similarly,

MONGODB-AWS authentication requires aws extra dependency:

pip install "motor[aws]"

Support for mongodb+srv:// URIs requires srv extra dependency:

pip install "motor[srv]"

OCSP requires ocsp extra dependency:

pip install "motor[ocsp]"

Wire protocol compression with snappy requires snappy extra dependency:

pip install "motor[snappy]"

Wire protocol compression with zstandard requires zstd extra dependency:

pip install "motor[zstd]"

Client-Side Field Level Encryption requires encryption extra dependency:

pip install "motor[encryption]"

You can install all dependencies automatically with the following command:

pip install "motor[gssapi,aws,ocsp,snappy,srv,zstd,encryption]"

See requirements for details about compatibility.

Examples

See the examples on ReadTheDocs.

Documentation

Motor's documentation is on ReadTheDocs.

Build the documentation with Python 3.9+. Install sphinx, Tornado, and aiohttp, and do cd doc; make html.

Learning Resources

Testing

Run python setup.py test. Tests are located in the test/ directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

motor-3.7.1.tar.gz (281.0 kB view details)

Uploaded Source

Built Distribution

motor-3.7.1-py3-none-any.whl (75.0 kB view details)

Uploaded Python 3

File details

Details for the file motor-3.7.1.tar.gz.

File metadata

  • Download URL: motor-3.7.1.tar.gz
  • Upload date:
  • Size: 281.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for motor-3.7.1.tar.gz
Algorithm Hash digest
SHA256 27b4d46625c87928f331a6ca9d7c51c2f518ba0e270939d395bc1ddc89d64526
MD5 d35c729f03ecdd564f6db064b9eae598
BLAKE2b-256 93ae96b88362d6a84cb372f7977750ac2a8aed7b2053eed260615df08d5c84f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for motor-3.7.1.tar.gz:

Publisher: release.yml on mongodb/motor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file motor-3.7.1-py3-none-any.whl.

File metadata

  • Download URL: motor-3.7.1-py3-none-any.whl
  • Upload date:
  • Size: 75.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for motor-3.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a63b9049e38eeeb56b4fdd57c3312a6d1f25d01db717fe7d82222393c410298
MD5 fa51877e4844a414a4a5e72e573ac584
BLAKE2b-256 019a35e053d4f442addf751ed20e0e922476508ee580786546d699b0567c4c67

See more details on using hashes here.

Provenance

The following attestation bundles were made for motor-3.7.1-py3-none-any.whl:

Publisher: release.yml on mongodb/motor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page