Changelog
Changes in Version 1.10
Version 1.10 includes changes to support new features in MongoDB 1.8.x.
Highlights include a modified map/reduce API including an inline map/reduce
helper method, a new find_and_modify helper, and the ability to query the
server for the maximum BSON document size it supports.
Warning
MongoDB versions greater than 1.7.4 no longer generate temporary
collections for map/reduce results. An output collection name must be
provided and the output will replace any existing output collection with
the same name. map_reduce() now
requires the out parameter.
Issues resolved
- PYTHON-225: pymongo.objectid.ObjectId class definition should use __slots__.
- PYTHON-223: Documentation fix.
- PYTHON-220: Documentation fix.
- PYTHON-219: KeyError in find_and_modify()
- PYTHON-213: Query server for maximum BSON document size.
- PYTHON-208: Fix pymongo.connection.Connection __repr__.
- PYTHON-207: Changes to Map/Reduce API.
- PYTHON-205: Accept slaveOk in the URI to match the URI docs.
- PYTHON-203: When slave_okay=True and we only specify one host don’t autodetect other set members.
- PYTHON-194: Show size when whining about a document being too large.
- PYTHON-184: Raise pymongo.errors.DuplicateKeyError for duplicate keys in capped collections.
- PYTHON-178: Don’t segfault when trying to encode a recursive data structure.
- PYTHON-177: Don’t segfault when decoding dicts with broken iterators.
- PYTHON-172: Fix a typo.
- PYTHON-170: Add find_and_modify().
- PYTHON-169: Support deepcopy of DBRef.
- PYTHON-167: Duplicate of PYTHON-166.
- PYTHON-166: Fixes a concurrency issue.
- PYTHON-158: Add code and err string to db assertion messages.
Changes in Version 1.9
Version 1.9 adds a new package to the PyMongo distribution,
bson. bson contains all of the BSON encoding and decoding logic, and the BSON
types that were formerly in the pymongo package. The following
modules have been renamed:
In addition, the following exception classes have been renamed:
The above exceptions now inherit from bson.errors.BSONError
rather than pymongo.errors.PyMongoError.
Note
All of the renamed modules and exceptions above have aliases
created with the old names, so these changes should not break
existing code. The old names will eventually be deprecated and then
removed, so users should begin migrating towards the new names now.
Warning
The change to the exception hierarchy mentioned above is
possibly breaking. If your code is catching
PyMongoError, then the exceptions raised
by bson will not be caught, even though they would have been
caught previously. Before upgrading, it is recommended that users
check for any cases like this.
- the C extension now shares buffer.c/h with the Ruby driver
- bson no longer raises InvalidName,
all occurrences have been replaced with
InvalidDocument.
- renamed bson._to_dicts() to decode_all().
- renamed from_dict() to encode()
and to_dict() to decode().
- added batch_size().
- allow updating (some) file metadata after a
GridIn instance has been closed.
- performance improvements for reading from GridFS.
- special cased slice with the same start and stop to return an empty
cursor.
- allow writing unicode to GridFS if an encoding
attribute has been specified for the file.
- added gridfs.GridFS.get_version().
- scope variables for Code can now be specified as
keyword arguments.
- added readline() to
GridOut.
- make a best effort to transparently auto-reconnect if a
Connection has been idle for a while.
- added list() to
SystemJS.
- added file_document argument to GridOut()
to allow initializing from an existing file document.
- raise TimeoutError even if the
getLastError command was run manually and not through “safe”
mode.
- added uuid support to json_util.
Changes in Version 1.8.1
- fixed a typo in the C extension that could cause safe-mode
operations to report a failure (SystemError) even when none
occurred.
- added a __ne__() implementation to any class where we define
__eq__().
Changes in Version 1.8
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.
Changes in Version 1.7
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.
Changes in Version 1.6
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.
Changes in Version 1.5.2
- fixed response handling to ignore unknown response flags in queries.
- handle server versions containing ‘-pre-‘.
Changes in Version 1.5.1
- 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.
Changes in Version 1.5
- 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.
Changes in Version 1.4
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
Changes in Version 1.3
- 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()
Changes in Version 1.2.1
- 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
Changes in Version 1.2
- 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
Changes in Version 1.1.2
- improvements to insert() speed
(using C for insert message creation)
- use random number for request_id
- fix some race conditions with AutoReconnect
Changes in Version 1.1.1
- 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
Changes in Version 1.1
- 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()
Changes in Version 0.16
- support for encoding/decoding uuid.UUID instances
- fix for explain() with limits
Changes in Version 0.15.2
- documentation changes only
Changes in Version 0.15.1
- 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
Changes in Version 0.15
- fix string representation of ObjectId
instances
- added timeout parameter for
find()
- allow scope for reduce function in
group()
Changes in Version 0.14.2
Changes in Version 0.14.1
- seek() and
tell() for (read mode)
GridFile instances
Changes in Version 0.12
- improved ObjectId generation
- added AutoReconnect exception for when
reconnection is possible
- make gridfs thread-safe
- fix for gridfs with non ObjectId _id
Changes in Version 0.11.3
- don’t allow NULL bytes in string encoder
- fixes for Python 2.3
Changes in Version 0.11.2
Changes in Version 0.11.1
- fix for connection pooling under Python 2.5
Changes in Version 0.11
- better build failure detection
- driver support for selecting fields in sub-documents
- disallow insertion of invalid key names
- added timeout parameter for Connection()
Changes in Version 0.10.3
- 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
Changes in Version 0.10.2
- support subclasses of dict in C encoder
Changes in Version 0.10.1
Changes in Version 0.9.7
- allow sub-collections of $cmd as valid
Collection names
- add version as pymongo.version
- add --no_ext command line option to setup.py