happi.backends.mongo_db.MongoBackend
- class happi.backends.mongo_db.MongoBackend(host=None, user=None, pw=None, db=None, collection=None, timeout=None, cfg_path=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.
cfg_path (str, optional) – Path to the happi config.
- __init__(host=None, user=None, pw=None, db=None, collection=None, timeout=None, cfg_path=None)
Methods
__init__
([host, user, pw, db, collection, ...])clear_cache
()Request to clear any cached data.
delete
(_id)Delete an item 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 an item by ID if it exists, or return None.
save
(_id, post[, insert])Save information to the database.
Attributes
all_items
List of all item sub-dictionaries.