.. include:: /includes/unicode-checkmark.rst

.. _python-async-driver:

====================
Motor (Async Driver)
====================

.. default-domain:: mongodb

.. contents:: On this page
   :local:
   :backlinks: none
   :depth: 2
   :class: twocols

Introduction
------------

**Motor (Python async)** is the recommended asynchronous Python driver for MongoDB.
It is compatible with `Tornado <http://www.tornadoweb.org/>`_ and
`asyncio <https://docs.python.org/3/library/asyncio.html>`_.

- `Tutorial <http://motor.readthedocs.org/en/stable/tutorial.html>`_

- `Documentation <http://motor.readthedocs.org/>`_

- `Changelog <http://motor.readthedocs.org/en/stable/changelog.html>`__

- `Source Code <https://github.com/mongodb/motor/>`__

- `Porting From PyMongo To Motor <http://emptysqua.re/blog/porting-from-pymongo-to-motor/>`_

- `Refactoring Tornado Coroutines <http://emptysqua.re/blog/refactoring-tornado-coroutines/>`_

- `All Motor articles on A. Jesse Jiryu Davis's blog <http://emptysqua.re/blog/category/motor/>`_


Installation
------------

We recommend using `pip <http://pypi.python.org/pypi/pip>`__ to install
Motor on all platforms:

.. code-block:: sh

   $ pip install motor


Connect to MongoDB Atlas
------------------------

.. include:: /includes/atlas-connect-blurb.rst

.. code-block:: python

   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
~~~~~~~~~~~~~~~~~~~~~

.. include:: /includes/extracts/motor-driver-compatibility-matrix-mongodb.rst

.. include:: /includes/mongodb-compatibility-table-motor.rst

.. include:: /includes/older-server-versions-unsupported.rst

Language Compatibility
~~~~~~~~~~~~~~~~~~~~~~

.. include:: /includes/extracts/motor-driver-compatibility-matrix-language.rst

.. include:: /includes/language-compatibility-table-motor.rst

.. include:: /includes/help-links-motor.rst
