Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-423

Support MongoClient / MongoReplicaSetClient defaulting to acknowledged write operations.

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      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.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: