ahvn.utils.mdb.mdb_utils module¶
MongoDB configuration utilities for AgentHeaven.
This module provides functions to parse and resolve MongoDB configurations similar to how database configurations are handled. It supports multiple MongoDB providers and generates PyMongo-ready configurations with connection strings and parameters.
- ahvn.utils.mdb.mdb_utils.resolve_mdb_config(database=None, collection=None, **kwargs)[source]¶
Compile a MongoDB configuration dictionary based on the following order of priority: 1. kwargs 2. global configuration When a parameter is specified in multiple places, the one with the highest priority is used.
- Parameters:
- Returns:
The resolved MongoDB configuration dictionary.
- Return type:
Example
>>> config = resolve_mdb_config(collection="my_collection") >>> config = resolve_mdb_config(host="192.168.1.100") >>> config = resolve_mdb_config(connection_string="mongodb://localhost:27017/mydb")