This change adds two new top level classes, MongoClient
and MongoReplicaSetClient. They work almost exactly the
same as Connection and ReplicaSetConnection with a few
differences:
1. These connection objects awknowledge write operations by default.
2. The network_timeout parameter is gone, use socketTimeoutMS instead.
3. auto_start_request defaults to False.
Default acknowledged write operation will be the biggest change for
most users. Using MongoClient and MongoReplicaSetClient you no longer
have to pass safe=True to a write method (save, update, insert, remove)
to request an acknowledgement from the server.
Connection and ReplicaSetConnection are now deprecated but retain their
previous behavior. This should not be a backward breaking change.
This change deprecates get|set|unset_lasterror_options,
replacing them with a write_concern attribute that can be
accessed directly. See the write_concern docstring for
an example of its use.
Replace the 'mongo' dict with a Member object everywhere in ReplicaSetConnection.
A handful of commands obey read preferences; most are always sent to primary.
Track a 5-sample moving average of each replica set member's ping time.
Connection detects whether it's connected to primary, secondary, or mongos.
- Support connecting to a replica set with no primary.
- Set read_preference at any driver level including per-query.
- Read preference SECONDARY only uses the primary as a last resort.
- SECONDARY_ONLY will never use the primary.
- During failover reader connections are not interrupted.
- refesh() method to refresh the host list and pools.
This is alpha level code and should not be used in
production. Issues that still need attention:
- Auto-authenticate existing sockets in all pools.
- A host of failover issues.
- A lot of error handling.
- Unit tests...
- More documentation and examples.
- Possibly a background thread to maintain the set.
The default binary subtype for UUIDs has changed
to 4. You can use bson.binary.UUIDLegacy to query
on UUIDs previously stored as subtype 3. See the
UUIDLegacy docstring for more details.
This change adds a new module common.py with some
common functions and classes used in a number of
pymongo modules.
The most important of these is the BaseObject class.
This provides a new base class that Connection, Database,
and Collection inherit from. The class provides attributes
common to each of these subclasses including slave_okay,
safe and getlasterror options.
With this change you can now set slaveok, safe, w, wtimeout,
fsync and j at the Connection, Database, Collection or per-
operation level. Each level inherits from and can override
the previous.
All of these options are now supported as keyword parameters
to connection.Connection and in the mongodb URI.