pygsti.io.mongodb.read_auxtree_from_mongodb#
- read_auxtree_from_mongodb(mongodb, collection_name, doc_id, auxfile_types_member='auxfile_types', ignore_meta=('_id', 'type'), separate_auxfiletypes=False, quick_load=False)#
Read a document containing links to auxiliary documents from a MongoDB database.
- Parameters:
mongodb (pymongo.database.Database) – The MongoDB instance to load data from.
collection_name (str) – the MongoDB collection within mongodb to read from.
doc_id (bson.objectid.ObjectId) – The identifier, of the root document to load from the database.
auxfile_types_member (str) – the name of the attribute within the document that holds the dictionary mapping of attributes to auxiliary-file (document) types. Usually this is “auxfile_types”.
ignore_meta (tuple, optional) – Keys within the root document that should be ignored, i.e. not loaded into elements of the returned dict. By default, “_id” and “type” are in this category because they give the database id and a class name to be built, respectively, and are not needed in the constructed dictionary. Unless you know what you’re doing, leave this as the default.
separate_auxfiletypes (bool, optional) – If True, then return the auxfile_types_member element (a dict describing how quantities that aren’t in the main document have been serialized) as a separate return value, instead of placing it within the returned dict.
quick_load (bool, optional) – Setting this to True skips the loading of members that may take a long time to load, namely those in separate documents that are large. When the loading of an attribute is skipped, it is set to None.
- Returns:
loaded_qtys (dict) – A dictionary of the quantities in the main document plus any loaded from the auxiliary documents.
auxfile_types (dict) – Only returned as a separate value when separate_auxfiletypes=True. A dict describing how members of loaded_qtys that weren’t loaded directly from the main document were serialized.