RequestsΒΆ

The start_request method of MongoClient and MongoReplicaSetClient is now deprecated and will be removed in PyMongo 3.0.

PyMongo versions previous to 3.0 support the idea of a request: a series of operations executed with a single socket. This feature intended to make read-your-writes consistency more likely, even with unacknowledged writes. (That is, operations with write concern w=0.)

However, mongos 2.6 doesn’t support socket pinning by default, and mongos 2.8 doesn’t support it at all, so requests provide no benefit with sharding.

In any case, requests are no longer necessary with PyMongo. By default, the methods insert(), update(), save(), and remove() block until they receive acknowledgment from the server, so ordered execution is already guaranteed. You can be certain the next find() or count(), for example, is executed on the server after the writes complete. This is called “read-your-writes consistency.” If your application requires this consistency, do not override the default write concern with w=0.

Previous topic

Gevent

Next topic

Python 3 FAQ

This Page