Python driver for MongoDB.
Current version of PyMongo.
Alias for pymongo.connection.Connection.
Alias for pymongo.replica_set_connection.ReplicaSetConnection.
An enum that defines the read preferences supported by PyMongo.
Connection type | Read Preference | ||
---|---|---|---|
PRIMARY | SECONDARY | SECONDARY_ONLY | |
Connection to a single host. | Queries are allowed if the connection is to the replica set primary. | Queries are allowed if the connection is to the replica set primary or a secondary. | Same as SECONDARY |
Connection to a mongos. | Queries are sent to the primary of a shard. | Queries are distributed among shard secondaries. Queries are sent to the primary if no secondaries are available. | Same as SECONDARY |
ReplicaSetConnection | Queries are sent to the primary of the replica set. | Queries are distributed among replica set secondaries. Queries are sent to the primary if no secondaries are available. | Queries are never sent to the replica set primary. An exception is raised if no secondary is available. |
Is the C extension installed?
New in version 1.5.
Sub-modules: