httk.store.backend.mongo.database¶
MongoDB client lifecycle and transaction-mode probing.
Exceptions¶
An explicit transaction was requested without replica-set support. |
Classes¶
A named MongoDB database reached through a wrapped PyMongo client. |
Module Contents¶
Bases:
RuntimeErrorAn explicit transaction was requested without replica-set support.
- class httk.store.backend.mongo.database.MongoDatabase(client, database, *, transactions='auto')¶
A named MongoDB database reached through a wrapped PyMongo client.
The wrapper performs one
helloprobe when it is constructed. A replica-set name in that reply enables transaction mode unless the caller explicitly pins degraded mode.- Parameters:
- Raises:
ValueError – If
transactionsis invalid or required transactions are unavailable.
- property client: pymongo.MongoClient¶
Return the wrapped PyMongo client.
- Returns:
The client that owns this database connection pool.
- Return type:
pymongo.MongoClient
- property database: Any¶
Return the selected PyMongo database handle.
- Returns:
The PyMongo database handle.
- Return type:
Any
- property supports_transactions: bool¶
Whether this wrapper is configured to use MongoDB transactions.
- Returns:
Truewhen the mode probe found a replica set and the mode was not pinned to"never".- Return type:
- dispose()¶
Close the client and its connection pool.
- Returns:
None.
- Return type:
None