NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #362 most downloaded on PyPI
PyMongo - the Official MongoDB Python driver
Latest stable
4.20.0
Last release 5 days ago
12 Nov 2026
Release timing varies
gaps range from 8 days to 4 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
18 years old
176 releases · first in 2009
Drag across the ruler to compare, or tap a release to open it.
DEPRECATED from_uri() and paired() , both are supplanted by extended functionality in Connection() .
Version 1.8 adds support for connecting to replica sets, specifying per-operation values for w and wtimeout , and decoding to timezone-aware datetimes.
fixed a reference leak in the C extension when decoding a DBRef .
added support for w , wtimeout , and fsync (and any other options for getLastError ) to “safe mode” operations.
added nodes property.
added a maximum pool size of 10 sockets.
added support for replica sets.
DEPRECATED from_uri() and paired() , both are supplanted by extended functionality in Connection() .
added tz aware support for datetimes in ObjectId , Timestamp and json_util methods.
added drop() helper.
reuse the socket used for finding the master when a Connection is first created.
added support for MinKey , MaxKey and Timestamp to json_util .
added support for decoding datetimes as aware (UTC) - it is highly recommended to enable this by setting the tz_aware parameter to Connection() to True .
added network_timeout option for individual calls to find() and find_one() .
added exists() to check if a file exists in GridFS.
added support for additional keys in DBRef instances.
added code attribute to OperationFailure exceptions.
fixed serialization of int and float subclasses in the C extension.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
BREAKING change to index_information() to add support for querying unique status and other index information.
Version 1.7 is a recommended upgrade for all PyMongo users. The full release notes are below, and some more in depth discussion of the highlights is here .
no longer attempt to build the C extension on big-endian systems.
added MinKey and MaxKey .
use unsigned for Timestamp in BSON encoder/decoder.
support True as "ok" in command responses, in addition to 1.0 - necessary for server versions >= 1.5.X
BREAKING change to index_information() to add support for querying unique status and other index information.
added document_class , to specify class for returned documents.
added as_class argument for find() , and in the BSON decoder.
added support for creating Timestamp instances using a datetime .
allow dropTarget argument for rename .
handle aware datetime instances, by converting to UTC.
added support for max_scan .
raise FileExists exception when creating a duplicate GridFS file.
use y2038 for time handling in the C extension - eliminates 2038 problems when extension is installed.
added sort parameter to find()
finalized deprecation of changes from versions <= 1.4
take any non- dict as an "_id" query for find_one() or remove()
added ability to pass a dict for fields argument to find() (supports "$slice" and field negation)
simplified code to find master, since paired setups don’t always have a remote
fixed bug in C encoder for certain invalid types (like Collection instances).
don’t transparently map "filename" key to name attribute for GridFS.
The biggest change in version 1.6 is a complete re-implementation of gridfs with a lot of improvements over the old implementation. There are many det
The biggest change in version 1.6 is a complete re-implementation of gridfs with a lot of improvements over the old implementation. There are many details and examples of using the new API in this blog post . The old API has been removed in this version, so existing code will need to be modified before upgrading to 1.6.
fixed issue where connection pool was being shared across Connection instances.
more improvements to Python code caching in C extension - should improve behavior on mod_wsgi.
added from_datetime() .
complete rewrite of gridfs support.
improvements to the command() API.
fixed drop_indexes() behavior on non-existent collections.
disallow empty bulk inserts.
fixed response handling to ignore unknown response flags in queries.
fixed response handling to ignore unknown response flags in queries.
handle server versions containing ‘-pre-‘.
added _id property for GridFile instances.
added _id property for GridFile instances.
fix for making a Connection (with slave_okay set) directly to a slave in a replica pair.
accept kwargs for create_index() and ensure_index() to support all indexing options.
add pymongo.GEO2D and support for geo indexing.
improvements to Python code caching in C extension - should improve behavior on mod_wsgi.
DEPRECATED options argument to Collection() and create_collection() in favor of kwargs.
added subtype constants to binary module.
DEPRECATED options argument to Collection() and create_collection() in favor of kwargs.
added has_c() to check for C extension.
added copy_database() .
added alive to tell when a cursor might have more data to return (useful for tailable cursors).
added Timestamp to better support dealing with internal MongoDB timestamps.
added name argument for create_index() and ensure_index() .
fixed connection pooling w/ fork
paired() takes all kwargs that are allowed for Connection() .
insert() returns list for bulk inserts of size one.
fixed handling of datetime.datetime instances in json_util .
added from_uri() to support MongoDB connection uri scheme.
fixed chunk number calculation when unaligned in gridfs .
command() takes a string for simple commands.
added system_js helper for dealing with server-side JS.
don’t wrap queries containing "$query" (support manual use of "$min" , etc.).
added GridFSError as base class for gridfs exceptions.
added PyMongoError as base exception class for all errors . this changes the exception hierarchy somewhat, and is a BREAKING change if you depend on C…
Perhaps the most important change in version 1.4 is that we have decided to no longer support Python 2.3 . The most immediate reason for this is to allow some improvements to connection pooling. This will also allow us to use some new (as in Python 2.4 ;) idioms and will help begin the path towards supporting Python 3.0. If you need to use Python 2.3 you should consider using version 1.3 of this driver, although that will no longer be actively supported.
Other changes:
move "_id" to front only for top-level documents (fixes some corner cases).
update() and remove() return the entire response to the lastError command when safe is True .
completed removal of things that were deprecated in version 1.2 or earlier.
enforce that collection names do not contain the NULL byte.
fix to allow using UTF-8 collection names with the C extension.
added PyMongoError as base exception class for all errors . this changes the exception hierarchy somewhat, and is a BREAKING change if you depend on ConnectionFailure being a IOError or InvalidBSON being a ValueError , for example.
added DuplicateKeyError for calls to insert() or update() with safe set to True .
removed thread_util .
added add_user() and remove_user() helpers.
fix for authenticate() when using non-UTF-8 names or passwords.
minor fixes for MasterSlaveConnection .
clean up all cases where ConnectionFailure is raised.
simplification of connection pooling - makes driver ~2x faster for simple benchmarks. see How does connection pooling work in PyMongo? for more information.
DEPRECATED pool_size , auto_start_request and timeout parameters to Connection . DEPRECATED start_request() .
use socket.sendall() .
removed from_xml() as it was only being used for some internal testing - also eliminates dependency on elementtree .
implementation of update() in C.
deprecate _command() in favor of command() .
send all commands without wrapping as {"query": ...} .
support string as key argument to group() (keyf) and run all groups as commands.
support for equality testing for Code instances.
allow the NULL byte in strings and disallow it in key names or regex patterns
DEPRECATED running group() as eval() , also changed default for group() to running as a command
DEPRECATED running group() as eval() , also changed default for group() to running as a command
remove pymongo.cursor.Cursor.len() , which was deprecated in 1.1.1 - needed to do this aggressively due to it’s presence breaking Django template for loops
DEPRECATED host() , port() , connection() , name() , database() , name() and full_name() in favor of host , port , connection , name , database , name and full_name , respectively. The deprecation schedule for this change will probably be faster than usual, as it carries some performance implications.
added disconnect()
added setup.py doc --test to run doctests for tutorial, examples
added Changelog to docs
added setup.py doc --test to run doctests for tutorial, examples
moved most examples to Sphinx docs (and remove from examples/ directory)
raise InvalidId instead of TypeError when passing a 24 character string to ObjectId that contains non-hexadecimal characters
allow unicode instances for ObjectId init
DEPRECATED url_encode() and url_decode() in favor of str() and ObjectId() , respectively
spec parameter for remove() is now optional to allow for deleting all documents in a Collection
always wrap queries with {query: ...} even when no special options - get around some issues with queries on fields named query
enforce 4MB document limit on the client side
added map_reduce() helper - see example
added distinct() method on Cursor instances to allow distinct with queries
fix for getitem() after skip()
allow any UTF-8 string in BSON encoder, not just ASCII subset
added generation_time
removed support for legacy ObjectId format - pretty sure this was never used, and is just confusing
DEPRECATED url_encode() and url_decode() in favor of str() and ObjectId() , respectively
allow oplog.$main as a valid collection name
some minor fixes for installation process
added support for datetime and regex in json_util
improvements to insert() speed (using C for insert message creation)
improvements to insert() speed (using C for insert message creation)
use random number for request_id
fix some race conditions with AutoReconnect
DEPRECATED pymongo.cursor.Cursor.__len__() in favor of count() with with_limit_and_skip set to True due to performance regression
added multi parameter for update()
fix unicode regex patterns with C extension
added distinct()
added database support for DBRef
added json_util with helpers for encoding / decoding special types to JSON
DEPRECATED pymongo.cursor.Cursor.len() in favor of count() with with_limit_and_skip set to True due to performance regression
switch documentation to Sphinx
DEPRECATED slave_okay parameter for individual queries
added hash() for DBRef and ObjectId
bulk insert() works with any iterable
fix ObjectId generation when using multiprocessing
added collection
added network_timeout parameter for Connection()
DEPRECATED slave_okay parameter for individual queries
fix for safe mode when multi-threaded
added safe parameter for remove()
added tailable parameter for find()
fixes for MasterSlaveConnection
fixes for MasterSlaveConnection
added finalize parameter for group()
improvements to insert() speed
improvements to gridfs speed
added getitem() and len() for Cursor instances
support for encoding/decoding uuid.UUID instances
support for encoding/decoding uuid.UUID instances
fix for explain() with limits
- documentation changes only
various performance improvements
various performance improvements
API CHANGE no longer need to specify direction for create_index() and ensure_index() when indexing a single key
support for encoding tuple instances as list instances
fix string representation of ObjectId instances
fix string representation of ObjectId instances
added timeout parameter for find()
allow scope for reduce function in group()
- minor bugfixes
seek() and tell() for (read mode) GridFile instances
added snapshot parameter for find()
support for long in BSON
added rename()
added snapshot parameter for find()
DEPRECATED passing an index name to hint()
better MasterSlaveConnection support
API CHANGE insert() and save() both return inserted _id
DEPRECATED passing an index name to hint()
added AutoReconnect exception for when reconnection is possible
improved ObjectId generation
added AutoReconnect exception for when reconnection is possible
make gridfs thread-safe
fix for gridfs with non ObjectId _id
don’t allow NULL bytes in string encoder
don’t allow NULL bytes in string encoder
fixes for Python 2.3
- PEP 8 - updates for group() - VS build
PEP 8
updates for group()
VS build
fix for connection pooling under Python 2.5
driver support for selecting fields in sub-documents
better build failure detection
driver support for selecting fields in sub-documents
disallow insertion of invalid key names
added timeout parameter for Connection()
better exception when modules get reloaded out from underneath the C extension
fix bug with large limit()
better exception when modules get reloaded out from underneath the C extension
better exception messages when calling a Collection or Database instance
support subclasses of dict in C encoder
alias Connection as pymongo.Connection
alias Connection as pymongo.Connection
raise an exception rather than silently overflowing in encoder
- added ensure_index()
allow sub-collections of $cmd as valid Collection names
allow sub-collections of $cmd as valid Collection names
add version as pymongo.version
add --no_ext command line option to setup.py
Changelog
Changes in Version 3.10.0
Issues Resolved
Changes in Version 3.9.0
Issues Resolved
Changes in Version 3.8.0
Issues Resolved
Changes in Version 3.7.2
Issues Resolved
Changes in Version 3.7.1
Issues Resolved
Changes in Version 3.7.0
Issues Resolved
Changes in Version 3.6.1
Issues Resolved
Changes in Version 3.6.0
Issues Resolved
Changes in Version 3.5.1
Issues Resolved
Changes in Version 3.5
Issues Resolved
Changes in Version 3.4
Issues Resolved
Changes in Version 3.3.1
Issues Resolved
Changes in Version 3.3
Issues Resolved
Changes in Version 3.2.2
Issues Resolved
Changes in Version 3.2.1
Issues Resolved
Changes in Version 3.2
Issues Resolved
Changes in Version 3.1.1
Issues Resolved
Changes in Version 3.1
Changes in internal classes
Issues Resolved
Changes in Version 3.0.3
Issues Resolved
Changes in Version 3.0.2
Issues Resolved
Changes in Version 3.0.1
Issues Resolved
Changes in Version 3.0
SONManipulator changes
SSL/TLS changes
Gevent Support
MongoClient changes
Cursor changes
Cursor management changes
Database changes
Collection changes
Changes to find() and find_one()
errors changes
gridfs changes
bson changes
Issues Resolved
Changes in Version 2.9.5
Issues Resolved
Changes in Version 2.9.4
Issues Resolved
Changes in Version 2.9.3
Issues Resolved
Changes in Version 2.9.2
Issues Resolved
Changes in Version 2.9.1
Issues Resolved
Changes in Version 2.9
Issues Resolved
Changes in Version 2.8.1
Issues Resolved
Changes in Version 2.8
Issues Resolved
Changes in Version 2.7.2
Issues Resolved
Changes in Version 2.7.1
Issues Resolved
Changes in Version 2.7
Breaking changes
Issues Resolved
Changes in Version 2.6.3
Issues Resolved
Changes in Version 2.6.2
Issues Resolved
Changes in Version 2.6.1
Issues Resolved
Changes in Version 2.6
Issues Resolved
Changes in Version 2.5.2
Issues Resolved
Changes in Version 2.5.1
Issues Resolved
Changes in Version 2.5
Issues Resolved
Changes in Version 2.4.2
Issues Resolved
Changes in Version 2.4.1
Issues Resolved
Changes in Version 2.4
Issues Resolved
Changes in Version 2.3
Issues Resolved
Changes in Version 2.2.1
Issues Resolved
Changes in Version 2.2
Issues Resolved
Changes in Version 2.1.1
Issues Resolved
Changes in Version 2.1
Issues Resolved
Changes in Version 2.0.1
Issues Resolved
Changes in Version 2.0
Issues Resolved
Changes in Version 1.11
Issues resolved
Changes in Version 1.10.1
Issues resolved
Changes in Version 1.10
Issues resolved
Changes in Version 1.9
Changes in Version 1.8.1
Changes in Version 1.8
Changes in Version 1.7
Changes in Version 1.6
Changes in Version 1.5.2
Changes in Version 1.5.1
Changes in Version 1.5
Changes in Version 1.4
Changes in Version 1.3
Changes in Version 1.2.1
Changes in Version 1.2
Changes in Version 1.1.2
Changes in Version 1.1.1
Changes in Version 1.1
Changes in Version 1.0
Changes in Version 0.16
Changes in Version 0.15.2
Changes in Version 0.15.1
Changes in Version 0.15
Changes in Version 0.14.2
Changes in Version 0.14.1
Changes in Version 0.14
Changes in Version 0.13
Changes in Version 0.12
Changes in Version 0.11.3
Changes in Version 0.11.2
Changes in Version 0.11.1
Changes in Version 0.11
Changes in Version 0.10.3
Changes in Version 0.10.2
Changes in Version 0.10.1
Changes in Version 0.10
Changes in Version 0.9.7
Contributors
Python 3 FAQ
index
modules |
next |
previous |
PyMongo 3.10.0 documentation »
© Copyright MongoDB, Inc. 2008-present. MongoDB, Mongo, and the leaf logo are registered trademarks of MongoDB, Inc.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.