Configuration#
- class quart_mongo.config.MongoConfig(*, uri: str | None = None, database: str | None = None, args: Tuple[Any] | None = None, kwargs: Dict[str, Any] | None = None)#
Stores the Mongo Configuration for quart_mongo.Mongo.
- Parameters:
uri – The MongoDB URI.
database – The database name.
args – arguments to pass to AIOMotorClient.
kwargs – extra arguments to pass to AIOMotorClient.
- quart_mongo.config.get_uri(app: Quart, uri: str | None) str #
Gets the MongoDB URI from the app configuration.
If no MongoDB URI is found in the app configuration. This function will set the
MONGO_URI
configuration variable toNone
as default.This function should not be called. It is called by quart_mongo.Mongo at creation time to get the MongoDB URI if one was not provided dirctly to it.
- Parameters:
app – The quart.Quart application.
uri – The MongoDB URI.
- Raises:
ValueError – If no MongoDB URI is found in the app configuration.