rpymostat.db package

rpymostat.db.connect_mongodb(host, port)[source]

Run setup_mongodb(). If that succeeds, connect to MongoDB via txmongo. Return a txmongo ConnectionPool.

Parameters:
  • host (str) – host to connect to MongoDB on.
  • port (int) – port to connect to MongoDB on.
Returns:

MongoDB connection pool

Return type:

txmongo.connection.ConnectionPool

rpymostat.db.get_collection(db_conn, collection_name)[source]

Return the specified collection object from the database.

Parameters:
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:
  • host (str) – host to connect to MongoDB on.
  • port (int) – port to connect to MongoDB on.