
Description
To talk to MongoDB from Python, rather than wiring up sockets and hand-rolling BSON, reach for the official driver. PyMongo is the MongoDB-maintained Python driver: one MongoClient wires up connections, CRUD, aggregation and transactions, and it tracks new server features so a third-party library never lags behind.
It maps the document model straight onto Python dicts, so query filters and update operations are ordinary dictionaries that read like the data itself. Since 4.x it also ships an async API, so one library serves both synchronous scripts and asyncio services.
Officially maintained: Built and continuously updated by MongoDB, so new server features land in the driver promptly with dependable compatibility.
Sync + async: A built-in async interface since 4.x lets synchronous scripts and asyncio services share one API, with no second library.
Full BSON support: Built-in BSON codecs, with aggregation pipelines, GridFS, multi-document transactions and change streams all available.
Production-grade connectivity: Connection pooling, replica sets, sharded clusters, read/write concerns and retries come out of the box.
Dicts as queries: Documents map to Python dicts and queries/updates are plain dictionaries, keeping the learning curve low and readable.
It maps the document model straight onto Python dicts, so query filters and update operations are ordinary dictionaries that read like the data itself. Since 4.x it also ships an async API, so one library serves both synchronous scripts and asyncio services.
Features
Officially maintained: Built and continuously updated by MongoDB, so new server features land in the driver promptly with dependable compatibility.
Sync + async: A built-in async interface since 4.x lets synchronous scripts and asyncio services share one API, with no second library.
Full BSON support: Built-in BSON codecs, with aggregation pipelines, GridFS, multi-document transactions and change streams all available.
Production-grade connectivity: Connection pooling, replica sets, sharded clusters, read/write concerns and retries come out of the box.
Dicts as queries: Documents map to Python dicts and queries/updates are plain dictionaries, keeping the learning curve low and readable.
