httk.store.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.mongo.database.MongoDatabase(client, database, *, transactions='auto')[source]¶
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.
- classmethod connect(uri, *, database, transactions='auto')[source]¶
Connect to a MongoDB URI with durable majority defaults.
- Parameters:
- Returns:
A connected database wrapper.
- Raises:
ValueError – If the requested transaction mode is unavailable.
- Return type:
Self
- property client: pymongo.MongoClient[source]¶
Return the wrapped PyMongo client.
- Returns:
The client that owns this database connection pool.
- Return type:
pymongo.MongoClient
- property database: Any[source]¶
Return the selected PyMongo database handle.
- Returns:
The PyMongo database handle.
- Return type:
Any