fastiot.db.mongodb_helper_fn module

class fastiot.db.mongodb_helper_fn.MongoClientWrapper(db_host, db_port, db_user=None, db_password=None, db_auth_source=None, db_compression=None)[source]
__init__(db_host, db_port, db_user=None, db_password=None, db_auth_source=None, db_compression=None)[source]

Constructor for a customer mongo client. Please note, that it will also set the feature compatibility version to the current mongodb version which may cause the database to be harder to downgrade.

Note: You have to manually install pymongo>=4.1,<5 using your requirements.txt to make use of this helper. Database clients are not automatically installed to keep the containers smaller.

get_client()[source]
fastiot.db.mongodb_helper_fn.get_mongodb_client_from_env()[source]

For connecting Mongodb, the environment variables can be set, if you want to use your own settings instead of default: FASTIOT_MONGO_DB_HOST, FASTIOT_MONGO_DB_PORT, FASTIOT_MONGO_DB_USER, FASTIOT_MONGO_DB_PASSWORD, FASTIOT_MONGO_DB_AUTH_SOURCE, FASTIOT_MONGO_DB_NAME

>>> mongo_client = get_mongodb_client_from_env()
fastiot.db.mongodb_helper_fn.time_series_data_to_mongodb_data_set(time_series_data)[source]
Return type:

Dict

fastiot.db.mongodb_helper_fn.time_series_data_from_mongodb_data_set(data_set)[source]
Return type:

TimeSeriesData