pymongo
PyMongo - the Official MongoDB Python driver
Decision gist · record as of 2026-08-14
Yes. PyMongo is the official, actively maintained MongoDB driver for Python with no known vulnerabilities, permissive licensing, and broad platform support. Install it if you need to connect Python to MongoDB. The single required dependency (dnspython) is lightweight. Optional dependencies for GSSAPI, AWS auth, OCSP, compression, and encryption are available but not required for basic use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a MongoDB server running and accessible at the connection URI; dnspython is automatically installed as a runtime dependency.
- Installation is straightforward with prebuilt wheels for CPython 3.9+ and PyPy3.9+ across major platforms (macOS, Windows, Linux).
- The single required runtime dependency is dnspython, needed only for mongodb+srv:// URIs.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing use in commercial and proprietary projects with minimal restrictions—you must include a copy of the license and notice of modifications, but there are no copyleft obligations.
last release 2026-04-20 (116 days) · last repo commit 2026-08-13 · 4,353 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 118,959,014 downloads/mo, #305 on PyPI
Alternatives
Verify before relying
pip install pymongo
import pymongo
client = pymongo.MongoClient("localhost", 27017)
db = client.test
db.my_collection.insert_one({"x": 10})
for item in db.my_collection.find():
print(item)- Performance characteristics and throughput benchmarks for typical workloads.
- Compatibility matrix details for specific MongoDB server versions beyond the stated 4.0–8.0 range.
- Detailed async API capabilities and differences from the synchronous interface.
What it is and what it does
PyMongo is the official Python driver for MongoDB, maintained by MongoDB Inc. It provides both synchronous and asynchronous APIs for connecting to, querying, and managing MongoDB databases. The package includes the bson module (BSON serialization), the pymongo module (core driver), and gridfs (large file storage). It supports MongoDB versions 4.0 through 8.0 and runs on CPython 3.9+ and PyPy3.9+ across macOS, Windows, and Linux.
Developers use PyMongo to perform standard database operations—inserting documents, querying with filters, creating indexes, and managing collections—directly from Python code. The driver handles connection pooling, authentication (including GSSAPI, AWS, and OCSP), wire protocol compression (snappy, zstandard), and client-side field-level encryption through optional dependencies. It follows semantic versioning and is actively maintained with comprehensive documentation.
Use it for
- Build web applications (Django, FastAPI, Flask) that read and write JSON-like documents to MongoDB.
- Perform bulk data ingestion and ETL pipelines, inserting or updating large document batches.
- Query and aggregate MongoDB data for analytics, reporting, or real-time dashboards.
- Store and retrieve large files (images, videos, logs) using the gridfs module.
- Implement asynchronous database operations in async/await Python applications.
- Manage multi-document transactions and complex queries with sorting, filtering, and pagination.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
PyMongo is the official, actively maintained MongoDB driver for Python with no known vulnerabilities, permissive licensing, and broad platform support. Install it if you need to connect Python to MongoDB. The single required dependency (dnspython) is lightweight. Optional dependencies for GSSAPI, AWS auth, OCSP, compression, and encryption are available but not required for basic use.
Install
pymongo on PyPI
Before you install
Installation is straightforward with prebuilt wheels for CPython 3.9+ and PyPy3.9+ across major platforms (macOS, Windows, Linux). The single required runtime dependency is dnspython, needed only for mongodb+srv:// URIs. The project is actively maintained with recent commits and a stable release cadence.
Requires a MongoDB server running and accessible at the connection URI; dnspython is automatically installed as a runtime dependency.
License in practice
Licensed under Apache-2.0 (permissive), allowing use in commercial and proprietary projects with minimal restrictions—you must include a copy of the license and notice of modifications, but there are no copyleft obligations.
Quickstart
pip install pymongo
import pymongo
client = pymongo.MongoClient("localhost", 27017)
db = client.test
db.my_collection.insert_one({"x": 10})
for item in db.my_collection.find():
print(item)
Verify before relying
- Performance characteristics and throughput benchmarks for typical workloads.
- Compatibility matrix details for specific MongoDB server versions beyond the stated 4.0–8.0 range.
- Detailed async API capabilities and differences from the synchronous interface.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packagednspython |
| Maintenance | Actively maintained 116 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 118,959,014 / month, #305 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: DatabaseTyping :: Typed |
Evidence: pymongo-4.17.0-cp310-cp310-macosx_10_9_x86_64.whl; pymongo-4.17.0-cp310-cp310-macosx_11_0_arm64.whl; pymongo-4.17.0-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl; pymongo-4.17.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pymongo-4.17.0-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl; pymongo-4.17.0-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl; pymongo-4.17.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pymongo-4.17.0-cp310-cp310-win32.whl; pymongo-4.17.0-cp310-cp310-win_amd64.whl; pymongo-4.17.0-cp310-cp310-win_arm64.whl; pymongo-4.17.0-cp311-cp311-macosx_10_9_x86_64.whl; pymongo-4.17.0-cp311-cp311-macosx_11_0_arm64.whl; pymongo-4.17.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl; pymongo-4.17.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pymongo-4.17.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl; pymongo-4.17.0-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl; pymongo-4.17.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; pymongo-4.17.0-cp311-cp311-win32.whl; pymongo-4.17.0-cp311-cp311-win_amd64.whl; pymongo-4.17.0-cp311-cp311-win_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pymongo database client”
- pymongoPyMongo is the official MongoDB Python driver, providing synchronous…
- mongomockMongomock provides an in-memory mock of MongoDB collections for…
- motorMotor provides a non-blocking MongoDB driver for asyncio and Tornado…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also bson · Flask-PyMongo · maggma · motor · pymongo-auth-aws · pymongo_inmemory · pymongoarrow · pymongocrypt · pymongoexplain · pydantic-mongo