mongodb_data_insert
MongoDB data insert
DB
A class to interact with a MongoDB database.
Source code in redesign_pipeline/db_utils/mongodb_data_insert.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
__init__(db, collection)
Initialize the DB class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db |
str
|
The name of the MongoDB database. |
required |
collection |
str
|
The name of the collection within the database. |
required |
Source code in redesign_pipeline/db_utils/mongodb_data_insert.py
9 10 11 12 13 14 15 16 17 18 19 20 | |
flush_db()
Delete all documents from the MongoDB collection.
Source code in redesign_pipeline/db_utils/mongodb_data_insert.py
31 32 33 34 | |
put_to_db(data)
Insert data into the MongoDB collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data |
dict
|
The data to be inserted into the collection. |
required |
Source code in redesign_pipeline/db_utils/mongodb_data_insert.py
22 23 24 25 26 27 28 29 | |