Source: factory.core/extend.data/ObjDataMongo.py
| Method | Signature | Description |
|---|---|---|
| get_package | get_package() -> str |
|
| get_domongo | get_domongo() -> bool |
|
| mongo_connect | mongo_connect() -> bool |
Establishes a connection to the MongoDB instance using credentials from the global config. |
| mongo_get_query | mongo_get_query(query_str: str = '') -> tuple[str, str] |
Parses a MongoDB aggregation query string to extract the collection name and pipeline. |
| mongo_index | mongo_index(collection_name: str, index_name: str) -> None |
Creates an index on the specified collection and index name in MongoDB. |
| mongo_insert | mongo_insert(collection_name: str, content: Any) -> bool |
Inserts a single document or multiple documents into the specified MongoDB collection. |
| mongo_update | mongo_update(collection_name: str, content: Dict[str, Any]) -> bool |
Updates a document in the specified MongoDB collection. |
| mongo_replace | mongo_replace(collection_name: str, content: Dict[str, Any]) -> None |
Replaces a document in the specified MongoDB collection. |
| mongo_pipeline | mongo_pipeline(collection_name: str, pipe_line: list) -> list |
An aggregation pipeline consists of one or more stages that process documents: |
| mongo_get_dict | mongo_get_dict(collection_name: str, key: Union[str, Dict[str, Any]], value: str = '') -> dict |
Retrieves a single document from the specified MongoDB collection based on a key-value pair or a query dictionary. |
| mongo_get_all_dicts | mongo_get_all_dicts(collection_name: str, key: Union[str, Dict[str, Any]], value: str = '') -> dict |
Retrieves all documents from the specified MongoDB collection that match a key-value pair or a query dictionary. |
| mongo_get_collection | mongo_get_collection(collection_name: str) -> dict |
Retrieves all documents from the specified MongoDB collection. |
| mongo_get_fields_from_collection | mongo_get_fields_from_collection(collection_name: str) -> list |
Retrieves a list of field names and their types from a MongoDB collection by sampling documents. |
| mongo_delete | mongo_delete(collection_name: str, key: str, value: str) -> None |
Deletes a document from the specified MongoDB collection based on a key-value pair. |