pygsti.io.mongodb.read_auxtree_from_mongodb_doc#
- read_auxtree_from_mongodb_doc(mongodb, doc, auxfile_types_member='auxfile_types', ignore_meta=('_id', 'type'), separate_auxfiletypes=False, quick_load=False)#
Load the contents of a MongoDB document into a dict.
The de-serialization possibly uses metadata within to root document to describe how associated data is stored in other collections.
- Parameters:
mongodb (pymongo.database.Database) – The MongoDB instance to load data from.
doc (dict) – The already-retrieved main document being read in.
auxfile_types_member (str, optional) – The key within the root document that is used to describe how other members have been serialized into documents. Unless you know what you’re doing, leave this as the default.
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 root 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 files whose files 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 ‘meta.json’ plus any loaded from the auxiliary files.
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 root document were serialized.