PyMongo 4.10.1 Documentation

Note

The PyMongo documentation has been migrated to the MongoDB Documentation site. As of PyMongo 4.10, the ReadTheDocs site will contain the detailed changelog and API docs, while the rest of the documentation will only appear on the MongoDB Documentation site.

Overview

PyMongo is a Python distribution containing tools for working with MongoDB, and is the recommended way to work with MongoDB from Python. This documentation attempts to explain everything you need to know to use PyMongo.

Installing / Upgrading

Instructions on how to get the distribution.

Tutorial

Start here for a quick overview.

Async Tutorial

Start here for a quick overview of the asynchronous API.

Examples

Examples of how to perform specific tasks.

Using PyMongo with MongoDB Atlas

Using PyMongo with MongoDB Atlas.

TLS/SSL and PyMongo

Using PyMongo with TLS / SSL.

In-Use Encryption

Using PyMongo with In-Use Encryption.

Type Hints

Using PyMongo with type hints.

Logging

Using PyMongo’s logging capabilities.

Frequently Asked Questions

Some questions that come up often.

PyMongo 4 Migration Guide

A PyMongo 3.x to 4.x migration guide.

Python 3 FAQ

Frequently asked questions about python 3 support.

Compatibility Policy

Explanation of deprecations, and how to keep pace with changes in PyMongo’s API.

API Documentation

The complete API documentation, organized by module.

Tools

A listing of Python tools and libraries that have been written for MongoDB.

Developer Guide

Developer guide for contributors to PyMongo.

Frequently Encountered Issues

Common issues encountered when using PyMongo.

Getting Help

If you’re having trouble or have questions about PyMongo, ask your question on our MongoDB Community Forum. You may also want to consider a commercial support subscription. Once you get an answer, it’d be great if you could work it back into this documentation and contribute!

Issues

All issues should be reported (and can be tracked / voted for / commented on) at the main MongoDB JIRA bug tracker, in the “Python Driver” project.

Feature Requests / Feedback

Use our feedback engine to send us feature requests and general feedback about PyMongo.

Contributing

PyMongo has a large community and contributions are always encouraged. Contributions can be as simple as minor tweaks to this documentation. To contribute, fork the project on GitHub and send a pull request.

Changes

See the Changelog for a full list of changes to PyMongo.

About This Documentation

This documentation is generated using the Sphinx documentation generator. The source files for the documentation are located in the doc/ directory of the PyMongo distribution. To generate the docs locally run the following command from the root directory of the PyMongo source:

$ pip install hatch
$ hatch run doc:build

Indices and tables