happi.backends.mongo_db.MongoBackend

class happi.backends.mongo_db.MongoBackend(host=None, user=None, pw=None, db=None, collection=None, timeout=None)

Abstraction for MongoDB backend

Parameters
  • host (str, optional) – Hostname for MongoDB

  • user (str, optional) – Username for MongoDB instance

  • pw (str, optional) – Password for given username

  • host – Host of the MongoDB instance

  • db (str, optional) – Database name within the MongoDB instance

  • timeout (float, optional) – Time to wait for connection attempt

__init__(host=None, user=None, pw=None, db=None, collection=None, timeout=None)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([host, user, pw, db, collection, …])

Initialize self.

delete(_id)

Delete a device instance from the database

find(to_match)

Yield all instances that match the given search criteria

find_range(key, *, start[, stop])

Find an instance or instances that matches the search criteria, such that start <= entry[key] < stop.

find_regex(to_match, *[, flags])

Yield all instances that match the given search criteria

get_by_id(_id)

Get a device by ID if it exists, or None

save(_id, post[, insert])

Save information to the database

Attributes

all_devices

List of all device sub-dictionaries