Master-Slave connection to Mongo.
Performs all writes to Master instance and distributes reads among all slaves. Reads are tried on each slave in turn until the read succeeds or all slaves failed.
Create a new Master-Slave connection.
The resultant connection should be interacted with using the same mechanisms as a regular Connection. The Connection instances used to create this MasterSlaveConnection can themselves make use of connection pooling, etc. ‘Connection’ instances used as slaves should be created with the slave_okay option set to True. Safe options are inherited from master and can be changed in this instance.
Raises TypeError if master is not an instance of Connection or slaves is not a list of at least one Connection instances.
Parameters : |
|
---|
Is it OK to perform queries on a secondary or slave?
New in version 2.0.
Use getlasterrer with every write operation?
New in version 2.0.
Returns a dict of the getlasterror options set on this instance.
New in version 2.0.
Set getlasterror options for this instance.
Valid options include j=<bool>, w=<int>, wtimeout=<int>, and fsync=<bool>. Implies safe=True.
Parameters : |
|
---|
New in version 2.0.
Unset getlasterror options for this instance.
If no options are passed unsets all getlasterror options. This does not set safe to False.
Parameters : |
|
---|
New in version 2.0.
Close a single database cursor.
Raises TypeError if cursor_id is not an instance of (int, long). What closing the cursor actually means depends on this connection’s cursor manager.
Parameters : |
|
---|
Get a list of all database names.
Disconnect from MongoDB.
Disconnecting will call disconnect on all master and slave connections.
See also
Module connection
New in version 1.10.1.
Drop a database.
Parameters : |
|
---|
End the current “request”.
See documentation for Connection.end_request.
Set the cursor manager for this connection.
Helper to set cursor manager for each individual Connection instance that make up this MasterSlaveConnection.
Start a “request”.
Start a sequence of operations in which order matters. Note that all operations performed within a request will be sent using the Master connection.