-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
By default PyMongo's Connection and ReplicaSetConnection objects do fire-and-forget write operations. This means they don't receive (or even request) a response from the server for any write operation (insert, save, update, remove). To enable write acknowledgement the developer has to set safe=True on the connection, database, or collection instance, or pass safe=True as a keyword parameter to the write method.
PyMongo will support new MongoClient and MongoReplicaSetClient objects that, by default, request acknowledgement that a write was successful, raising an appropriate exception otherwise. The old fire-and-forget behavior can still be configured with these new objects using w=0.
Other changes:
- auto_start_request will default to False, since this is more efficient (fewer sockets, less time spent creating connections) and requests are not required for read-your-writes consistency if writes are acknowledged.
- The network_timeout parameter is not supported by these classes. Use socketTimeoutMS instead.
Connection and ReplicaSetConnection will be deprecated but continue to exist, with their current behavior, until at least PyMongo 3.0.
- has to be done before
-
PYTHON-424 Update any tutorials for switch to default write acknowledgement
- Closed
-
PYTHON-425 Update presentations for switch to default write acknowledgement
- Closed
-
PYTHON-426 Blog post for switch to default write acknowledgement
- Closed
- is depended on by
-
PYTHON-437 Replace 'safe' with 'w' in internal methods.
- Closed
- related to
-
PYTHON-427 New write concern API
- Closed
-
PYTHON-429 Insert's, update's, remove's return values are under-documented
- Closed