providers.mongodb.MongoDbDtoKeyValueStore
MongoDB specific KVStore provider for Pydantic model (DTO) data.
Usage
providers.mongodb.MongoDbDtoKeyValueStore(
*, client, config, dto_model, collection_name
)This store allows arbitrary DTOs (Pydantic models) to be stored as values, with the DTO model passed in the constructor.
Methods
| Name | Description |
|---|---|
| __init__() | Initialize the provider with configuration, model type, and collection name. |
__init__()
Initialize the provider with configuration, model type, and collection name.
Usage
__init__(*, client, config, dto_model, collection_name)Parameters
client: AsyncMongoClient-
An instance of an async MongoDB client.
config: MongoDbConfig-
MongoDB-specific config parameters.
dto_model: type[Dto]-
The Pydantic model type to support for values.
collection_name: str- Name of the collection to hold the key-value pairs.