weaver.database
Submodules
Package Contents
- weaver.database.get_db(container: weaver.typedefs.AnyRegistryContainer | weaver.typedefs.AnySettingsContainer | None = None, reset_connection: bool = False) mongodb.MongoDatabase [source]
Obtains the database connection from configured application settings.
If
reset_connection
isTrue
, thecontainer
must be the applicationRegistry
or any container that can retrieve it to accomplish reference reset. Otherwise, any settings container can be provided.Note
It is preferable to provide a registry reference to reuse any available connection whenever possible. Giving application settings will require establishing a new connection.