cowbird.database.mongodb

Module Contents

Classes

MongoDatabase

Return the unique identifier of db type matching settings.

Functions

get_mongodb_connection(→ pymongo.database.Database)

Obtains the basic database connection from settings.

get_mongodb_engine(→ pymongo.database.Database)

Obtains the database with configuration ready for usage.

Attributes

MongoDB

MongodbStores

AnyMongodbStore

AnyMongodbStoreType

cowbird.database.mongodb.MongoDB: pymongo.database.Database | None[source]
cowbird.database.mongodb.MongodbStores[source]
cowbird.database.mongodb.AnyMongodbStore[source]
cowbird.database.mongodb.AnyMongodbStoreType[source]
class cowbird.database.mongodb.MongoDatabase(container: cowbird.typedefs.AnySettingsContainer)[source]

Bases: cowbird.database.base.DatabaseInterface

Return the unique identifier of db type matching settings.

Initialize the mongo database from various type of container.

_database: pymongo.database.Database[source]
_settings: cowbird.typedefs.SettingsType[source]
_stores: Dict[str, AnyMongodbStore][source]
type = 'mongodb'[source]
reset_store(store_type: AnyMongodbStoreType) AnyMongodbStore | None[source]
get_store(store_type: str | Type[cowbird.database.stores.StoreInterface] | AnyMongodbStoreType, *store_args: Any, **store_kwargs: Any) AnyMongodbStore[source]

Retrieve a store from the database.

Parameters:
  • store_type – type of the store to retrieve/create.

  • store_args – additional arguments to pass down to the store.

  • store_kwargs – additional keyword arguments to pass down to the store.

get_session() Any[source]
get_information() cowbird.typedefs.JSON[source]
Returns:

{‘version’: version, ‘type’: db_type}

is_ready() bool[source]
cowbird.database.mongodb.get_mongodb_connection(container: cowbird.typedefs.AnySettingsContainer) pymongo.database.Database[source]

Obtains the basic database connection from settings.

cowbird.database.mongodb.get_mongodb_engine(container: cowbird.typedefs.AnySettingsContainer) pymongo.database.Database[source]

Obtains the database with configuration ready for usage.