Mongo Utils¶
This is mongo utils
Centralised utility class for all operations to be performed on a mongo database.
-
class
mongo_utils.
MongoUtils
(address='127.0.0.1', port=27017, db_name='', collection_name='')¶ -
get_list_from_db
(filter_condition=None)¶ Connect to mongo db and fetch data.
Parameters: filter_condition – Filter condition Returns: Return collection as a list
-
insert_record
(new_record=None)¶ Insert a record in table :param new_record: New record to be inserted. :return:
-
update_record
(filter_condition=None, new_value=None)¶ Connect to mongo db and update data.
Parameters: - filter_condition – Filter condition
- new_value – new value of the selected document
Returns: Return collection as a list
-