rpymostat.db package¶
-
rpymostat.db.
connect_mongodb
(host, port)[source]¶ Run
setup_mongodb()
. If that succeeds, connect to MongoDB viatxmongo
. Return a txmongo ConnectionPool.Parameters: Returns: MongoDB connection pool
Return type:
-
rpymostat.db.
get_collection
(db_conn, collection_name)[source]¶ Return the specified collection object from the database.
Parameters: - db_conn (txmongo.connection.ConnectionPool) – MongoDB ConnectionPool
- collection_name (str) – name of the collection to get; should be a constant in this module
Returns: txmongo.collection.Collection
-
rpymostat.db.
setup_mongodb
(host, port)[source]¶ Connect synchronously (outside/before the reactor loop) to MongoDB and setup whatever we need. Raise an exception if this fails. This mainly exists to test that the DB is running and accessible before running the reactor loop.
Parameters: