<!-- # hard line break macro for HTML -->

# fiftyone.core.odm

* [fiftyone.core.odm.database](fiftyone.core.odm.database.md)
  * [`DatabaseConfigDocument`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.DatabaseConfigDocument)
    * [`DatabaseConfigDocument.version`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.DatabaseConfigDocument.version)
    * [`DatabaseConfigDocument.type`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.DatabaseConfigDocument.type)
    * [`DatabaseConfigDocument.save()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.DatabaseConfigDocument.save)
  * [`get_db_config()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.get_db_config)
  * [`establish_db_conn()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.establish_db_conn)
  * [`aggregate()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.aggregate)
  * [`ensure_connection()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.ensure_connection)
  * [`get_db_client()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.get_db_client)
  * [`get_db_conn()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.get_db_conn)
  * [`get_db_version()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.get_db_version)
  * [`get_async_db_client()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.get_async_db_client)
  * [`get_async_db_conn()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.get_async_db_conn)
  * [`drop_database()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.drop_database)
  * [`sync_database()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.sync_database)
  * [`list_collections()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.list_collections)
  * [`drop_collection()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.drop_collection)
  * [`drop_orphan_collections()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.drop_orphan_collections)
  * [`drop_orphan_saved_views()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.drop_orphan_saved_views)
  * [`drop_orphan_generated_datasets()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.drop_orphan_generated_datasets)
  * [`drop_orphan_workspaces()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.drop_orphan_workspaces)
  * [`drop_orphan_runs()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.drop_orphan_runs)
  * [`drop_orphan_delegated_ops()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.drop_orphan_delegated_ops)
  * [`drop_orphan_stores()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.drop_orphan_stores)
  * [`drop_orphan_tags()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.drop_orphan_tags)
  * [`stream_collection()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.stream_collection)
  * [`get_collection_stats()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.get_collection_stats)
  * [`count_documents()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.count_documents)
  * [`export_document()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.export_document)
  * [`export_collection()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.export_collection)
  * [`import_document()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.import_document)
  * [`import_collection()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.import_collection)
  * [`insert_documents()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.insert_documents)
  * [`bulk_write()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.bulk_write)
  * [`list_datasets()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.list_datasets)
  * [`load_dataset()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.load_dataset)
  * [`patch_saved_views()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.patch_saved_views)
  * [`patch_workspaces()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.patch_workspaces)
  * [`patch_annotation_runs()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.patch_annotation_runs)
  * [`patch_brain_runs()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.patch_brain_runs)
  * [`patch_evaluations()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.patch_evaluations)
  * [`patch_runs()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.patch_runs)
  * [`delete_dataset()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_dataset)
  * [`delete_saved_view()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_saved_view)
  * [`delete_saved_views()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_saved_views)
  * [`delete_workspace()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_workspace)
  * [`delete_workspaces()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_workspaces)
  * [`delete_annotation_run()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_annotation_run)
  * [`delete_annotation_runs()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_annotation_runs)
  * [`delete_brain_run()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_brain_run)
  * [`delete_brain_runs()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_brain_runs)
  * [`delete_evaluation()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_evaluation)
  * [`delete_evaluations()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_evaluations)
  * [`delete_run()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_run)
  * [`delete_runs()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.delete_runs)
  * [`get_indexed_values()`](fiftyone.core.odm.database.md#fiftyone.core.odm.database.get_indexed_values)
* [fiftyone.core.odm.dataset](fiftyone.core.odm.dataset.md)
  * [`SampleFieldDocument`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument)
    * [`SampleFieldDocument.name`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.name)
    * [`SampleFieldDocument.ftype`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.ftype)
    * [`SampleFieldDocument.embedded_doc_type`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.embedded_doc_type)
    * [`SampleFieldDocument.subfield`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.subfield)
    * [`SampleFieldDocument.fields`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.fields)
    * [`SampleFieldDocument.db_field`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.db_field)
    * [`SampleFieldDocument.description`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.description)
    * [`SampleFieldDocument.info`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.info)
    * [`SampleFieldDocument.read_only`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.read_only)
    * [`SampleFieldDocument.created_at`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.created_at)
    * [`SampleFieldDocument.to_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.to_field)
    * [`SampleFieldDocument.from_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.from_field)
    * [`SampleFieldDocument.STRICT`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.STRICT)
    * [`SampleFieldDocument.clean()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.clean)
    * [`SampleFieldDocument.clear_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.clear_field)
    * [`SampleFieldDocument.copy()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.copy)
    * [`SampleFieldDocument.fancy_repr()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.fancy_repr)
    * [`SampleFieldDocument.field_names`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.field_names)
    * [`SampleFieldDocument.field_to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.field_to_mongo)
    * [`SampleFieldDocument.field_to_python()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.field_to_python)
    * [`SampleFieldDocument.from_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.from_dict)
    * [`SampleFieldDocument.from_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.from_json)
    * [`SampleFieldDocument.get_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.get_field)
    * [`SampleFieldDocument.get_text_score()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.get_text_score)
    * [`SampleFieldDocument.has_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.has_field)
    * [`SampleFieldDocument.iter_fields()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.iter_fields)
    * [`SampleFieldDocument.merge()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.merge)
    * [`SampleFieldDocument.my_metaclass`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.my_metaclass)
    * [`SampleFieldDocument.set_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.set_field)
    * [`SampleFieldDocument.to_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.to_dict)
    * [`SampleFieldDocument.to_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.to_json)
    * [`SampleFieldDocument.to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.to_mongo)
    * [`SampleFieldDocument.validate()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument.validate)
  * [`SidebarGroupDocument`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument)
    * [`SidebarGroupDocument.name`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.name)
    * [`SidebarGroupDocument.paths`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.paths)
    * [`SidebarGroupDocument.expanded`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.expanded)
    * [`SidebarGroupDocument.STRICT`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.STRICT)
    * [`SidebarGroupDocument.clean()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.clean)
    * [`SidebarGroupDocument.clear_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.clear_field)
    * [`SidebarGroupDocument.copy()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.copy)
    * [`SidebarGroupDocument.fancy_repr()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.fancy_repr)
    * [`SidebarGroupDocument.field_names`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.field_names)
    * [`SidebarGroupDocument.field_to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.field_to_mongo)
    * [`SidebarGroupDocument.field_to_python()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.field_to_python)
    * [`SidebarGroupDocument.from_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.from_dict)
    * [`SidebarGroupDocument.from_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.from_json)
    * [`SidebarGroupDocument.get_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.get_field)
    * [`SidebarGroupDocument.get_text_score()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.get_text_score)
    * [`SidebarGroupDocument.has_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.has_field)
    * [`SidebarGroupDocument.iter_fields()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.iter_fields)
    * [`SidebarGroupDocument.merge()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.merge)
    * [`SidebarGroupDocument.my_metaclass`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.my_metaclass)
    * [`SidebarGroupDocument.set_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.set_field)
    * [`SidebarGroupDocument.to_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.to_dict)
    * [`SidebarGroupDocument.to_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.to_json)
    * [`SidebarGroupDocument.to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.to_mongo)
    * [`SidebarGroupDocument.validate()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SidebarGroupDocument.validate)
  * [`ActiveFields`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields)
    * [`ActiveFields.exclude`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.exclude)
    * [`ActiveFields.paths`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.paths)
    * [`ActiveFields.STRICT`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.STRICT)
    * [`ActiveFields.clean()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.clean)
    * [`ActiveFields.clear_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.clear_field)
    * [`ActiveFields.copy()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.copy)
    * [`ActiveFields.fancy_repr()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.fancy_repr)
    * [`ActiveFields.field_names`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.field_names)
    * [`ActiveFields.field_to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.field_to_mongo)
    * [`ActiveFields.field_to_python()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.field_to_python)
    * [`ActiveFields.from_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.from_dict)
    * [`ActiveFields.from_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.from_json)
    * [`ActiveFields.get_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.get_field)
    * [`ActiveFields.get_text_score()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.get_text_score)
    * [`ActiveFields.has_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.has_field)
    * [`ActiveFields.iter_fields()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.iter_fields)
    * [`ActiveFields.merge()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.merge)
    * [`ActiveFields.my_metaclass`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.my_metaclass)
    * [`ActiveFields.set_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.set_field)
    * [`ActiveFields.to_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.to_dict)
    * [`ActiveFields.to_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.to_json)
    * [`ActiveFields.to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.to_mongo)
    * [`ActiveFields.validate()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ActiveFields.validate)
  * [`ColorScheme`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme)
    * [`ColorScheme.id`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.id)
    * [`ColorScheme.color_pool`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.color_pool)
    * [`ColorScheme.color_by`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.color_by)
    * [`ColorScheme.fields`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.fields)
    * [`ColorScheme.label_tags`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.label_tags)
    * [`ColorScheme.temporal_tags`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.temporal_tags)
    * [`ColorScheme.multicolor_keypoints`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.multicolor_keypoints)
    * [`ColorScheme.opacity`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.opacity)
    * [`ColorScheme.show_skeletons`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.show_skeletons)
    * [`ColorScheme.default_mask_targets_colors`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.default_mask_targets_colors)
    * [`ColorScheme.colorscales`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.colorscales)
    * [`ColorScheme.default_colorscale`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.default_colorscale)
    * [`ColorScheme.STRICT`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.STRICT)
    * [`ColorScheme.clean()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.clean)
    * [`ColorScheme.clear_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.clear_field)
    * [`ColorScheme.copy()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.copy)
    * [`ColorScheme.fancy_repr()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.fancy_repr)
    * [`ColorScheme.field_names`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.field_names)
    * [`ColorScheme.field_to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.field_to_mongo)
    * [`ColorScheme.field_to_python()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.field_to_python)
    * [`ColorScheme.from_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.from_dict)
    * [`ColorScheme.from_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.from_json)
    * [`ColorScheme.get_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.get_field)
    * [`ColorScheme.get_text_score()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.get_text_score)
    * [`ColorScheme.has_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.has_field)
    * [`ColorScheme.iter_fields()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.iter_fields)
    * [`ColorScheme.merge()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.merge)
    * [`ColorScheme.my_metaclass`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.my_metaclass)
    * [`ColorScheme.set_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.set_field)
    * [`ColorScheme.to_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.to_dict)
    * [`ColorScheme.to_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.to_json)
    * [`ColorScheme.to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.to_mongo)
    * [`ColorScheme.validate()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.ColorScheme.validate)
  * [`KeypointSkeleton`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton)
    * [`KeypointSkeleton.labels`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.labels)
    * [`KeypointSkeleton.edges`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.edges)
    * [`KeypointSkeleton.STRICT`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.STRICT)
    * [`KeypointSkeleton.clean()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.clean)
    * [`KeypointSkeleton.clear_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.clear_field)
    * [`KeypointSkeleton.copy()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.copy)
    * [`KeypointSkeleton.fancy_repr()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.fancy_repr)
    * [`KeypointSkeleton.field_names`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.field_names)
    * [`KeypointSkeleton.field_to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.field_to_mongo)
    * [`KeypointSkeleton.field_to_python()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.field_to_python)
    * [`KeypointSkeleton.from_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.from_dict)
    * [`KeypointSkeleton.from_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.from_json)
    * [`KeypointSkeleton.get_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.get_field)
    * [`KeypointSkeleton.get_text_score()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.get_text_score)
    * [`KeypointSkeleton.has_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.has_field)
    * [`KeypointSkeleton.iter_fields()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.iter_fields)
    * [`KeypointSkeleton.merge()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.merge)
    * [`KeypointSkeleton.my_metaclass`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.my_metaclass)
    * [`KeypointSkeleton.set_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.set_field)
    * [`KeypointSkeleton.to_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.to_dict)
    * [`KeypointSkeleton.to_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.to_json)
    * [`KeypointSkeleton.to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.to_mongo)
    * [`KeypointSkeleton.validate()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.KeypointSkeleton.validate)
  * [`DatasetAppConfig`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig)
    * [`DatasetAppConfig.active_fields`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.active_fields)
    * [`DatasetAppConfig.color_scheme`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.color_scheme)
    * [`DatasetAppConfig.disable_frame_filtering`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.disable_frame_filtering)
    * [`DatasetAppConfig.dynamic_groups_target_frame_rate`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.dynamic_groups_target_frame_rate)
    * [`DatasetAppConfig.grid_media_field`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.grid_media_field)
    * [`DatasetAppConfig.media_fallback`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.media_fallback)
    * [`DatasetAppConfig.media_fields`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.media_fields)
    * [`DatasetAppConfig.modal_media_field`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.modal_media_field)
    * [`DatasetAppConfig.plugins`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.plugins)
    * [`DatasetAppConfig.sidebar_groups`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.sidebar_groups)
    * [`DatasetAppConfig.default_active_fields()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.default_active_fields)
    * [`DatasetAppConfig.default_sidebar_groups()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.default_sidebar_groups)
    * [`DatasetAppConfig.is_custom()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.is_custom)
    * [`DatasetAppConfig.STRICT`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.STRICT)
    * [`DatasetAppConfig.clean()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.clean)
    * [`DatasetAppConfig.clear_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.clear_field)
    * [`DatasetAppConfig.copy()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.copy)
    * [`DatasetAppConfig.fancy_repr()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.fancy_repr)
    * [`DatasetAppConfig.field_names`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.field_names)
    * [`DatasetAppConfig.field_to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.field_to_mongo)
    * [`DatasetAppConfig.field_to_python()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.field_to_python)
    * [`DatasetAppConfig.from_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.from_dict)
    * [`DatasetAppConfig.from_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.from_json)
    * [`DatasetAppConfig.get_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.get_field)
    * [`DatasetAppConfig.get_text_score()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.get_text_score)
    * [`DatasetAppConfig.has_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.has_field)
    * [`DatasetAppConfig.iter_fields()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.iter_fields)
    * [`DatasetAppConfig.merge()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.merge)
    * [`DatasetAppConfig.my_metaclass`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.my_metaclass)
    * [`DatasetAppConfig.set_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.set_field)
    * [`DatasetAppConfig.to_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.to_dict)
    * [`DatasetAppConfig.to_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.to_json)
    * [`DatasetAppConfig.to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.to_mongo)
    * [`DatasetAppConfig.validate()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetAppConfig.validate)
  * [`DatasetDocument`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument)
    * [`DatasetDocument.name`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.name)
    * [`DatasetDocument.slug`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.slug)
    * [`DatasetDocument.version`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.version)
    * [`DatasetDocument.created_at`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.created_at)
    * [`DatasetDocument.last_modified_at`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.last_modified_at)
    * [`DatasetDocument.last_deletion_at`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.last_deletion_at)
    * [`DatasetDocument.last_loaded_at`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.last_loaded_at)
    * [`DatasetDocument.sample_collection_name`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.sample_collection_name)
    * [`DatasetDocument.frame_collection_name`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.frame_collection_name)
    * [`DatasetDocument.persistent`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.persistent)
    * [`DatasetDocument.media_type`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.media_type)
    * [`DatasetDocument.group_field`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.group_field)
    * [`DatasetDocument.group_media_types`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.group_media_types)
    * [`DatasetDocument.default_group_slice`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.default_group_slice)
    * [`DatasetDocument.tags`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.tags)
    * [`DatasetDocument.description`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.description)
    * [`DatasetDocument.info`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.info)
    * [`DatasetDocument.app_config`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.app_config)
    * [`DatasetDocument.classes`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.classes)
    * [`DatasetDocument.default_classes`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.default_classes)
    * [`DatasetDocument.mask_targets`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.mask_targets)
    * [`DatasetDocument.default_mask_targets`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.default_mask_targets)
    * [`DatasetDocument.skeletons`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.skeletons)
    * [`DatasetDocument.default_skeleton`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.default_skeleton)
    * [`DatasetDocument.camera_intrinsics`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.camera_intrinsics)
    * [`DatasetDocument.static_transforms`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.static_transforms)
    * [`DatasetDocument.sample_fields`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.sample_fields)
    * [`DatasetDocument.frame_fields`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.frame_fields)
    * [`DatasetDocument.saved_views`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.saved_views)
    * [`DatasetDocument.workspaces`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.workspaces)
    * [`DatasetDocument.annotation_runs`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.annotation_runs)
    * [`DatasetDocument.brain_methods`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.brain_methods)
    * [`DatasetDocument.evaluations`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.evaluations)
    * [`DatasetDocument.runs`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.runs)
    * [`DatasetDocument.active_label_schemas`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.active_label_schemas)
    * [`DatasetDocument.label_schemas`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.label_schemas)
    * [`DatasetDocument.frame_label_schemas`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.frame_label_schemas)
    * [`DatasetDocument.get_stored_label_schema()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.get_stored_label_schema)
    * [`DatasetDocument.set_stored_label_schema()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.set_stored_label_schema)
    * [`DatasetDocument.all_stored_label_schemas()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.all_stored_label_schemas)
    * [`DatasetDocument.set_all_stored_label_schemas()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.set_all_stored_label_schemas)
    * [`DatasetDocument.get_saved_views()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.get_saved_views)
    * [`DatasetDocument.get_workspaces()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.get_workspaces)
    * [`DatasetDocument.get_annotation_runs()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.get_annotation_runs)
    * [`DatasetDocument.get_brain_methods()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.get_brain_methods)
    * [`DatasetDocument.get_evaluations()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.get_evaluations)
    * [`DatasetDocument.get_runs()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.get_runs)
    * [`DatasetDocument.DoesNotExist`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.DoesNotExist)
      * [`DatasetDocument.DoesNotExist.add_note()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.DoesNotExist.add_note)
      * [`DatasetDocument.DoesNotExist.args`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.DoesNotExist.args)
      * [`DatasetDocument.DoesNotExist.with_traceback()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.DoesNotExist.with_traceback)
    * [`DatasetDocument.MultipleObjectsReturned`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.MultipleObjectsReturned)
      * [`DatasetDocument.MultipleObjectsReturned.add_note()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.MultipleObjectsReturned.add_note)
      * [`DatasetDocument.MultipleObjectsReturned.args`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.MultipleObjectsReturned.args)
      * [`DatasetDocument.MultipleObjectsReturned.with_traceback()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.MultipleObjectsReturned.with_traceback)
    * [`DatasetDocument.STRICT`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.STRICT)
    * [`DatasetDocument.cascade_save()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.cascade_save)
    * [`DatasetDocument.clean()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.clean)
    * [`DatasetDocument.clear_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.clear_field)
    * [`DatasetDocument.compare_indexes()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.compare_indexes)
    * [`DatasetDocument.copy()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.copy)
    * [`DatasetDocument.copy_with_new_id()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.copy_with_new_id)
    * [`DatasetDocument.create_index()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.create_index)
    * [`DatasetDocument.delete()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.delete)
    * [`DatasetDocument.drop_collection()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.drop_collection)
    * [`DatasetDocument.ensure_indexes()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.ensure_indexes)
    * [`DatasetDocument.fancy_repr()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.fancy_repr)
    * [`DatasetDocument.field_names`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.field_names)
    * [`DatasetDocument.field_to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.field_to_mongo)
    * [`DatasetDocument.field_to_python()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.field_to_python)
    * [`DatasetDocument.from_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.from_dict)
    * [`DatasetDocument.from_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.from_json)
    * [`DatasetDocument.get_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.get_field)
    * [`DatasetDocument.get_text_score()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.get_text_score)
    * [`DatasetDocument.has_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.has_field)
    * [`DatasetDocument.id`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.id)
    * [`DatasetDocument.in_db`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.in_db)
    * [`DatasetDocument.iter_fields()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.iter_fields)
    * [`DatasetDocument.list_indexes()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.list_indexes)
    * [`DatasetDocument.merge()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.merge)
    * [`DatasetDocument.modify()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.modify)
    * [`DatasetDocument.my_metaclass`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.my_metaclass)
    * [`DatasetDocument.pk`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.pk)
    * [`DatasetDocument.register_delete_rule()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.register_delete_rule)
    * [`DatasetDocument.reload()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.reload)
    * [`DatasetDocument.save()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.save)
    * [`DatasetDocument.select_related()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.select_related)
    * [`DatasetDocument.set_field()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.set_field)
    * [`DatasetDocument.switch_collection()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.switch_collection)
    * [`DatasetDocument.switch_db()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.switch_db)
    * [`DatasetDocument.to_dbref()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.to_dbref)
    * [`DatasetDocument.to_dict()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.to_dict)
    * [`DatasetDocument.to_json()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.to_json)
    * [`DatasetDocument.to_mongo()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.to_mongo)
    * [`DatasetDocument.update()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.update)
    * [`DatasetDocument.validate()`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.DatasetDocument.validate)
* [fiftyone.core.odm.document](fiftyone.core.odm.document.md)
  * [`SerializableDocument`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument)
    * [`SerializableDocument.field_names`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.field_names)
    * [`SerializableDocument.fancy_repr()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.fancy_repr)
    * [`SerializableDocument.has_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.has_field)
    * [`SerializableDocument.get_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.get_field)
    * [`SerializableDocument.set_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.set_field)
    * [`SerializableDocument.clear_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.clear_field)
    * [`SerializableDocument.iter_fields()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.iter_fields)
    * [`SerializableDocument.copy()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.copy)
    * [`SerializableDocument.merge()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.merge)
    * [`SerializableDocument.to_dict()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.to_dict)
    * [`SerializableDocument.from_dict()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.from_dict)
    * [`SerializableDocument.to_json()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.to_json)
    * [`SerializableDocument.from_json()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument.from_json)
  * [`MongoEngineBaseDocument`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument)
    * [`MongoEngineBaseDocument.field_names`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.field_names)
    * [`MongoEngineBaseDocument.has_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.has_field)
    * [`MongoEngineBaseDocument.get_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.get_field)
    * [`MongoEngineBaseDocument.set_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.set_field)
    * [`MongoEngineBaseDocument.clear_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.clear_field)
    * [`MongoEngineBaseDocument.field_to_mongo()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.field_to_mongo)
    * [`MongoEngineBaseDocument.field_to_python()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.field_to_python)
    * [`MongoEngineBaseDocument.to_dict()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.to_dict)
    * [`MongoEngineBaseDocument.from_dict()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.from_dict)
    * [`MongoEngineBaseDocument.copy()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.copy)
    * [`MongoEngineBaseDocument.fancy_repr()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.fancy_repr)
    * [`MongoEngineBaseDocument.from_json()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.from_json)
    * [`MongoEngineBaseDocument.iter_fields()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.iter_fields)
    * [`MongoEngineBaseDocument.merge()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.merge)
    * [`MongoEngineBaseDocument.to_json()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument.to_json)
  * [`DynamicMixin`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicMixin)
    * [`DynamicMixin.to_mongo()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicMixin.to_mongo)
  * [`BaseDocument`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument)
    * [`BaseDocument.id`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.id)
    * [`BaseDocument.in_db`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.in_db)
    * [`BaseDocument.clear_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.clear_field)
    * [`BaseDocument.copy()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.copy)
    * [`BaseDocument.fancy_repr()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.fancy_repr)
    * [`BaseDocument.field_names`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.field_names)
    * [`BaseDocument.field_to_mongo()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.field_to_mongo)
    * [`BaseDocument.field_to_python()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.field_to_python)
    * [`BaseDocument.from_dict()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.from_dict)
    * [`BaseDocument.from_json()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.from_json)
    * [`BaseDocument.get_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.get_field)
    * [`BaseDocument.has_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.has_field)
    * [`BaseDocument.iter_fields()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.iter_fields)
    * [`BaseDocument.merge()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.merge)
    * [`BaseDocument.set_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.set_field)
    * [`BaseDocument.to_dict()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.to_dict)
    * [`BaseDocument.to_json()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument.to_json)
  * [`DynamicDocument`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument)
    * [`DynamicDocument.id`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.id)
    * [`DynamicDocument.STRICT`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.STRICT)
    * [`DynamicDocument.cascade_save()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.cascade_save)
    * [`DynamicDocument.clean()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.clean)
    * [`DynamicDocument.clear_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.clear_field)
    * [`DynamicDocument.compare_indexes()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.compare_indexes)
    * [`DynamicDocument.copy()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.copy)
    * [`DynamicDocument.create_index()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.create_index)
    * [`DynamicDocument.delete()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.delete)
    * [`DynamicDocument.drop_collection()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.drop_collection)
    * [`DynamicDocument.ensure_indexes()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.ensure_indexes)
    * [`DynamicDocument.fancy_repr()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.fancy_repr)
    * [`DynamicDocument.field_names`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.field_names)
    * [`DynamicDocument.field_to_mongo()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.field_to_mongo)
    * [`DynamicDocument.field_to_python()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.field_to_python)
    * [`DynamicDocument.from_dict()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.from_dict)
    * [`DynamicDocument.from_json()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.from_json)
    * [`DynamicDocument.get_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.get_field)
    * [`DynamicDocument.get_text_score()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.get_text_score)
    * [`DynamicDocument.has_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.has_field)
    * [`DynamicDocument.in_db`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.in_db)
    * [`DynamicDocument.iter_fields()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.iter_fields)
    * [`DynamicDocument.list_indexes()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.list_indexes)
    * [`DynamicDocument.merge()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.merge)
    * [`DynamicDocument.modify()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.modify)
    * [`DynamicDocument.my_metaclass`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.my_metaclass)
    * [`DynamicDocument.pk`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.pk)
    * [`DynamicDocument.register_delete_rule()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.register_delete_rule)
    * [`DynamicDocument.reload()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.reload)
    * [`DynamicDocument.save()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.save)
    * [`DynamicDocument.select_related()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.select_related)
    * [`DynamicDocument.set_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.set_field)
    * [`DynamicDocument.switch_collection()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.switch_collection)
    * [`DynamicDocument.switch_db()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.switch_db)
    * [`DynamicDocument.to_dbref()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.to_dbref)
    * [`DynamicDocument.to_dict()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.to_dict)
    * [`DynamicDocument.to_json()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.to_json)
    * [`DynamicDocument.to_mongo()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.to_mongo)
    * [`DynamicDocument.update()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.update)
    * [`DynamicDocument.validate()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicDocument.validate)
  * [`Document`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document)
    * [`Document.id`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.id)
    * [`Document.copy()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.copy)
    * [`Document.reload()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.reload)
    * [`Document.save()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.save)
    * [`Document.copy_with_new_id()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.copy_with_new_id)
    * [`Document.STRICT`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.STRICT)
    * [`Document.cascade_save()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.cascade_save)
    * [`Document.clean()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.clean)
    * [`Document.clear_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.clear_field)
    * [`Document.compare_indexes()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.compare_indexes)
    * [`Document.create_index()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.create_index)
    * [`Document.delete()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.delete)
    * [`Document.drop_collection()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.drop_collection)
    * [`Document.ensure_indexes()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.ensure_indexes)
    * [`Document.fancy_repr()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.fancy_repr)
    * [`Document.field_names`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.field_names)
    * [`Document.field_to_mongo()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.field_to_mongo)
    * [`Document.field_to_python()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.field_to_python)
    * [`Document.from_dict()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.from_dict)
    * [`Document.from_json()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.from_json)
    * [`Document.get_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.get_field)
    * [`Document.get_text_score()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.get_text_score)
    * [`Document.has_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.has_field)
    * [`Document.in_db`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.in_db)
    * [`Document.iter_fields()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.iter_fields)
    * [`Document.list_indexes()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.list_indexes)
    * [`Document.merge()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.merge)
    * [`Document.modify()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.modify)
    * [`Document.my_metaclass`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.my_metaclass)
    * [`Document.pk`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.pk)
    * [`Document.register_delete_rule()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.register_delete_rule)
    * [`Document.select_related()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.select_related)
    * [`Document.set_field()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.set_field)
    * [`Document.switch_collection()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.switch_collection)
    * [`Document.switch_db()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.switch_db)
    * [`Document.to_dbref()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.to_dbref)
    * [`Document.to_dict()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.to_dict)
    * [`Document.to_json()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.to_json)
    * [`Document.to_mongo()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.to_mongo)
    * [`Document.update()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.update)
    * [`Document.validate()`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document.validate)
* [fiftyone.core.odm.embedded_document](fiftyone.core.odm.embedded_document.md)
  * [`BaseEmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument)
    * [`BaseEmbeddedDocument.clear_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.clear_field)
    * [`BaseEmbeddedDocument.copy()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.copy)
    * [`BaseEmbeddedDocument.fancy_repr()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.fancy_repr)
    * [`BaseEmbeddedDocument.field_names`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.field_names)
    * [`BaseEmbeddedDocument.field_to_mongo()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.field_to_mongo)
    * [`BaseEmbeddedDocument.field_to_python()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.field_to_python)
    * [`BaseEmbeddedDocument.from_dict()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.from_dict)
    * [`BaseEmbeddedDocument.from_json()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.from_json)
    * [`BaseEmbeddedDocument.get_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.get_field)
    * [`BaseEmbeddedDocument.has_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.has_field)
    * [`BaseEmbeddedDocument.iter_fields()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.iter_fields)
    * [`BaseEmbeddedDocument.merge()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.merge)
    * [`BaseEmbeddedDocument.set_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.set_field)
    * [`BaseEmbeddedDocument.to_dict()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.to_dict)
    * [`BaseEmbeddedDocument.to_json()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument.to_json)
  * [`EmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument)
    * [`EmbeddedDocument.STRICT`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.STRICT)
    * [`EmbeddedDocument.clean()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.clean)
    * [`EmbeddedDocument.clear_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.clear_field)
    * [`EmbeddedDocument.copy()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.copy)
    * [`EmbeddedDocument.fancy_repr()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.fancy_repr)
    * [`EmbeddedDocument.field_names`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.field_names)
    * [`EmbeddedDocument.field_to_mongo()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.field_to_mongo)
    * [`EmbeddedDocument.field_to_python()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.field_to_python)
    * [`EmbeddedDocument.from_dict()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.from_dict)
    * [`EmbeddedDocument.from_json()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.from_json)
    * [`EmbeddedDocument.get_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.get_field)
    * [`EmbeddedDocument.get_text_score()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.get_text_score)
    * [`EmbeddedDocument.has_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.has_field)
    * [`EmbeddedDocument.iter_fields()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.iter_fields)
    * [`EmbeddedDocument.merge()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.merge)
    * [`EmbeddedDocument.my_metaclass`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.my_metaclass)
    * [`EmbeddedDocument.set_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.set_field)
    * [`EmbeddedDocument.to_dict()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.to_dict)
    * [`EmbeddedDocument.to_json()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.to_json)
    * [`EmbeddedDocument.to_mongo()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.to_mongo)
    * [`EmbeddedDocument.validate()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument.validate)
  * [`DynamicEmbeddedDocumentException`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocumentException)
    * [`DynamicEmbeddedDocumentException.add_note()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocumentException.add_note)
    * [`DynamicEmbeddedDocumentException.args`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocumentException.args)
    * [`DynamicEmbeddedDocumentException.with_traceback()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocumentException.with_traceback)
  * [`DynamicEmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument)
    * [`DynamicEmbeddedDocument.STRICT`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.STRICT)
    * [`DynamicEmbeddedDocument.clean()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.clean)
    * [`DynamicEmbeddedDocument.clear_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.clear_field)
    * [`DynamicEmbeddedDocument.copy()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.copy)
    * [`DynamicEmbeddedDocument.fancy_repr()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.fancy_repr)
    * [`DynamicEmbeddedDocument.field_names`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.field_names)
    * [`DynamicEmbeddedDocument.field_to_mongo()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.field_to_mongo)
    * [`DynamicEmbeddedDocument.field_to_python()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.field_to_python)
    * [`DynamicEmbeddedDocument.from_dict()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.from_dict)
    * [`DynamicEmbeddedDocument.from_json()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.from_json)
    * [`DynamicEmbeddedDocument.get_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.get_field)
    * [`DynamicEmbeddedDocument.get_text_score()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.get_text_score)
    * [`DynamicEmbeddedDocument.has_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.has_field)
    * [`DynamicEmbeddedDocument.iter_fields()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.iter_fields)
    * [`DynamicEmbeddedDocument.merge()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.merge)
    * [`DynamicEmbeddedDocument.my_metaclass`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.my_metaclass)
    * [`DynamicEmbeddedDocument.set_field()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.set_field)
    * [`DynamicEmbeddedDocument.to_dict()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.to_dict)
    * [`DynamicEmbeddedDocument.to_json()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.to_json)
    * [`DynamicEmbeddedDocument.to_mongo()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.to_mongo)
    * [`DynamicEmbeddedDocument.validate()`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.DynamicEmbeddedDocument.validate)
* [fiftyone.core.odm.frame](fiftyone.core.odm.frame.md)
  * [`DatasetFrameDocument`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument)
    * [`DatasetFrameDocument.id`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.id)
    * [`DatasetFrameDocument.frame_number`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.frame_number)
    * [`DatasetFrameDocument.created_at`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.created_at)
    * [`DatasetFrameDocument.last_modified_at`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.last_modified_at)
    * [`DatasetFrameDocument.STRICT`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.STRICT)
    * [`DatasetFrameDocument.add_field()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.add_field)
    * [`DatasetFrameDocument.add_implied_field()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.add_implied_field)
    * [`DatasetFrameDocument.cascade_save()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.cascade_save)
    * [`DatasetFrameDocument.clean()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.clean)
    * [`DatasetFrameDocument.clear_field()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.clear_field)
    * [`DatasetFrameDocument.collection_name`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.collection_name)
    * [`DatasetFrameDocument.compare_indexes()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.compare_indexes)
    * [`DatasetFrameDocument.copy()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.copy)
    * [`DatasetFrameDocument.copy_with_new_id()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.copy_with_new_id)
    * [`DatasetFrameDocument.create_index()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.create_index)
    * [`DatasetFrameDocument.delete()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.delete)
    * [`DatasetFrameDocument.drop_collection()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.drop_collection)
    * [`DatasetFrameDocument.ensure_indexes()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.ensure_indexes)
    * [`DatasetFrameDocument.fancy_repr()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.fancy_repr)
    * [`DatasetFrameDocument.field_names`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.field_names)
    * [`DatasetFrameDocument.field_to_mongo()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.field_to_mongo)
    * [`DatasetFrameDocument.field_to_python()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.field_to_python)
    * [`DatasetFrameDocument.from_dict()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.from_dict)
    * [`DatasetFrameDocument.from_json()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.from_json)
    * [`DatasetFrameDocument.get_field()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.get_field)
    * [`DatasetFrameDocument.get_field_schema()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.get_field_schema)
    * [`DatasetFrameDocument.get_text_score()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.get_text_score)
    * [`DatasetFrameDocument.has_field()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.has_field)
    * [`DatasetFrameDocument.in_db`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.in_db)
    * [`DatasetFrameDocument.iter_fields()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.iter_fields)
    * [`DatasetFrameDocument.list_indexes()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.list_indexes)
    * [`DatasetFrameDocument.merge()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.merge)
    * [`DatasetFrameDocument.merge_field_schema()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.merge_field_schema)
    * [`DatasetFrameDocument.modify()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.modify)
    * [`DatasetFrameDocument.my_metaclass`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.my_metaclass)
    * [`DatasetFrameDocument.pk`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.pk)
    * [`DatasetFrameDocument.register_delete_rule()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.register_delete_rule)
    * [`DatasetFrameDocument.reload()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.reload)
    * [`DatasetFrameDocument.save()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.save)
    * [`DatasetFrameDocument.select_related()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.select_related)
    * [`DatasetFrameDocument.set_field()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.set_field)
    * [`DatasetFrameDocument.switch_collection()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.switch_collection)
    * [`DatasetFrameDocument.switch_db()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.switch_db)
    * [`DatasetFrameDocument.to_dbref()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.to_dbref)
    * [`DatasetFrameDocument.to_dict()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.to_dict)
    * [`DatasetFrameDocument.to_json()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.to_json)
    * [`DatasetFrameDocument.to_mongo()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.to_mongo)
    * [`DatasetFrameDocument.update()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.update)
    * [`DatasetFrameDocument.validate()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.DatasetFrameDocument.validate)
  * [`NoDatasetFrameDocument`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument)
    * [`NoDatasetFrameDocument.default_fields`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.default_fields)
    * [`NoDatasetFrameDocument.default_fields_ordered`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.default_fields_ordered)
    * [`NoDatasetFrameDocument.clear_field()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.clear_field)
    * [`NoDatasetFrameDocument.copy()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.copy)
    * [`NoDatasetFrameDocument.delete()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.delete)
    * [`NoDatasetFrameDocument.fancy_repr()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.fancy_repr)
    * [`NoDatasetFrameDocument.field_names`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.field_names)
    * [`NoDatasetFrameDocument.from_dict()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.from_dict)
    * [`NoDatasetFrameDocument.from_json()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.from_json)
    * [`NoDatasetFrameDocument.get_field()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.get_field)
    * [`NoDatasetFrameDocument.has_field()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.has_field)
    * [`NoDatasetFrameDocument.in_db`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.in_db)
    * [`NoDatasetFrameDocument.iter_fields()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.iter_fields)
    * [`NoDatasetFrameDocument.merge()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.merge)
    * [`NoDatasetFrameDocument.reload()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.reload)
    * [`NoDatasetFrameDocument.save()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.save)
    * [`NoDatasetFrameDocument.set_field()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.set_field)
    * [`NoDatasetFrameDocument.to_dict()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.to_dict)
    * [`NoDatasetFrameDocument.to_json()`](fiftyone.core.odm.frame.md#fiftyone.core.odm.frame.NoDatasetFrameDocument.to_json)
* [fiftyone.core.odm.mixins](fiftyone.core.odm.mixins.md)
  * [`get_default_fields()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.get_default_fields)
  * [`DatasetMixin`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin)
    * [`DatasetMixin.collection_name`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin.collection_name)
    * [`DatasetMixin.field_names`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin.field_names)
    * [`DatasetMixin.get_field()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin.get_field)
    * [`DatasetMixin.set_field()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin.set_field)
    * [`DatasetMixin.clear_field()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin.clear_field)
    * [`DatasetMixin.get_field_schema()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin.get_field_schema)
    * [`DatasetMixin.merge_field_schema()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin.merge_field_schema)
    * [`DatasetMixin.add_field()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin.add_field)
    * [`DatasetMixin.add_implied_field()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin.add_implied_field)
  * [`NoDatasetMixin`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin)
    * [`NoDatasetMixin.field_names`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.field_names)
    * [`NoDatasetMixin.in_db`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.in_db)
    * [`NoDatasetMixin.has_field()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.has_field)
    * [`NoDatasetMixin.get_field()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.get_field)
    * [`NoDatasetMixin.set_field()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.set_field)
    * [`NoDatasetMixin.clear_field()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.clear_field)
    * [`NoDatasetMixin.to_dict()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.to_dict)
    * [`NoDatasetMixin.from_dict()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.from_dict)
    * [`NoDatasetMixin.save()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.save)
    * [`NoDatasetMixin.reload()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.reload)
    * [`NoDatasetMixin.delete()`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin.delete)
* [fiftyone.core.odm.ontology](fiftyone.core.odm.ontology.md)
  * [`OntologyType`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType)
    * [`OntologyType.TAXONOMY`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.TAXONOMY)
    * [`OntologyType.ANNOTATION_ONTOLOGY`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.ANNOTATION_ONTOLOGY)
    * [`OntologyType.encode()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.encode)
    * [`OntologyType.replace()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.replace)
    * [`OntologyType.split()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.split)
    * [`OntologyType.rsplit()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.rsplit)
    * [`OntologyType.join()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.join)
    * [`OntologyType.capitalize()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.capitalize)
    * [`OntologyType.casefold()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.casefold)
    * [`OntologyType.title()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.title)
    * [`OntologyType.center()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.center)
    * [`OntologyType.count()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.count)
    * [`OntologyType.expandtabs()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.expandtabs)
    * [`OntologyType.find()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.find)
    * [`OntologyType.partition()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.partition)
    * [`OntologyType.index()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.index)
    * [`OntologyType.ljust()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.ljust)
    * [`OntologyType.lower()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.lower)
    * [`OntologyType.lstrip()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.lstrip)
    * [`OntologyType.rfind()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.rfind)
    * [`OntologyType.rindex()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.rindex)
    * [`OntologyType.rjust()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.rjust)
    * [`OntologyType.rstrip()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.rstrip)
    * [`OntologyType.rpartition()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.rpartition)
    * [`OntologyType.splitlines()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.splitlines)
    * [`OntologyType.strip()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.strip)
    * [`OntologyType.swapcase()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.swapcase)
    * [`OntologyType.translate()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.translate)
    * [`OntologyType.upper()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.upper)
    * [`OntologyType.startswith()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.startswith)
    * [`OntologyType.endswith()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.endswith)
    * [`OntologyType.removeprefix()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.removeprefix)
    * [`OntologyType.removesuffix()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.removesuffix)
    * [`OntologyType.isascii()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.isascii)
    * [`OntologyType.islower()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.islower)
    * [`OntologyType.isupper()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.isupper)
    * [`OntologyType.istitle()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.istitle)
    * [`OntologyType.isspace()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.isspace)
    * [`OntologyType.isdecimal()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.isdecimal)
    * [`OntologyType.isdigit()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.isdigit)
    * [`OntologyType.isnumeric()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.isnumeric)
    * [`OntologyType.isalpha()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.isalpha)
    * [`OntologyType.isalnum()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.isalnum)
    * [`OntologyType.isidentifier()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.isidentifier)
    * [`OntologyType.isprintable()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.isprintable)
    * [`OntologyType.zfill()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.zfill)
    * [`OntologyType.format()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.format)
    * [`OntologyType.format_map()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.format_map)
    * [`OntologyType.maketrans()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyType.maketrans)
  * [`OntologyDocument`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument)
    * [`OntologyDocument.name`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.name)
    * [`OntologyDocument.slug`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.slug)
    * [`OntologyDocument.version`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.version)
    * [`OntologyDocument.schema_version`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.schema_version)
    * [`OntologyDocument.type`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.type)
    * [`OntologyDocument.description`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.description)
    * [`OntologyDocument.root`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.root)
    * [`OntologyDocument.created_at`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.created_at)
    * [`OntologyDocument.last_modified_at`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.last_modified_at)
    * [`OntologyDocument.save()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.save)
    * [`OntologyDocument.DoesNotExist`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.DoesNotExist)
      * [`OntologyDocument.DoesNotExist.add_note()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.DoesNotExist.add_note)
      * [`OntologyDocument.DoesNotExist.args`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.DoesNotExist.args)
      * [`OntologyDocument.DoesNotExist.with_traceback()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.DoesNotExist.with_traceback)
    * [`OntologyDocument.MultipleObjectsReturned`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.MultipleObjectsReturned)
      * [`OntologyDocument.MultipleObjectsReturned.add_note()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.MultipleObjectsReturned.add_note)
      * [`OntologyDocument.MultipleObjectsReturned.args`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.MultipleObjectsReturned.args)
      * [`OntologyDocument.MultipleObjectsReturned.with_traceback()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.MultipleObjectsReturned.with_traceback)
    * [`OntologyDocument.STRICT`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.STRICT)
    * [`OntologyDocument.cascade_save()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.cascade_save)
    * [`OntologyDocument.clean()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.clean)
    * [`OntologyDocument.clear_field()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.clear_field)
    * [`OntologyDocument.compare_indexes()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.compare_indexes)
    * [`OntologyDocument.copy()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.copy)
    * [`OntologyDocument.copy_with_new_id()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.copy_with_new_id)
    * [`OntologyDocument.create_index()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.create_index)
    * [`OntologyDocument.delete()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.delete)
    * [`OntologyDocument.drop_collection()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.drop_collection)
    * [`OntologyDocument.ensure_indexes()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.ensure_indexes)
    * [`OntologyDocument.fancy_repr()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.fancy_repr)
    * [`OntologyDocument.field_names`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.field_names)
    * [`OntologyDocument.field_to_mongo()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.field_to_mongo)
    * [`OntologyDocument.field_to_python()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.field_to_python)
    * [`OntologyDocument.from_dict()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.from_dict)
    * [`OntologyDocument.from_json()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.from_json)
    * [`OntologyDocument.get_field()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.get_field)
    * [`OntologyDocument.get_text_score()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.get_text_score)
    * [`OntologyDocument.has_field()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.has_field)
    * [`OntologyDocument.id`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.id)
    * [`OntologyDocument.in_db`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.in_db)
    * [`OntologyDocument.iter_fields()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.iter_fields)
    * [`OntologyDocument.list_indexes()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.list_indexes)
    * [`OntologyDocument.merge()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.merge)
    * [`OntologyDocument.modify()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.modify)
    * [`OntologyDocument.my_metaclass`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.my_metaclass)
    * [`OntologyDocument.pk`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.pk)
    * [`OntologyDocument.register_delete_rule()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.register_delete_rule)
    * [`OntologyDocument.reload()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.reload)
    * [`OntologyDocument.select_related()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.select_related)
    * [`OntologyDocument.set_field()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.set_field)
    * [`OntologyDocument.switch_collection()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.switch_collection)
    * [`OntologyDocument.switch_db()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.switch_db)
    * [`OntologyDocument.to_dbref()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.to_dbref)
    * [`OntologyDocument.to_dict()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.to_dict)
    * [`OntologyDocument.to_json()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.to_json)
    * [`OntologyDocument.to_mongo()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.to_mongo)
    * [`OntologyDocument.update()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.update)
    * [`OntologyDocument.validate()`](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument.validate)
* [fiftyone.core.odm.runs](fiftyone.core.odm.runs.md)
  * [`RunDocument`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument)
    * [`RunDocument.dataset_id`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.dataset_id)
    * [`RunDocument.key`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.key)
    * [`RunDocument.version`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.version)
    * [`RunDocument.timestamp`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.timestamp)
    * [`RunDocument.config`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.config)
    * [`RunDocument.view_stages`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.view_stages)
    * [`RunDocument.results`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.results)
    * [`RunDocument.results_meta`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.results_meta)
    * [`RunDocument.DoesNotExist`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.DoesNotExist)
      * [`RunDocument.DoesNotExist.add_note()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.DoesNotExist.add_note)
      * [`RunDocument.DoesNotExist.args`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.DoesNotExist.args)
      * [`RunDocument.DoesNotExist.with_traceback()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.DoesNotExist.with_traceback)
    * [`RunDocument.MultipleObjectsReturned`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.MultipleObjectsReturned)
      * [`RunDocument.MultipleObjectsReturned.add_note()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.MultipleObjectsReturned.add_note)
      * [`RunDocument.MultipleObjectsReturned.args`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.MultipleObjectsReturned.args)
      * [`RunDocument.MultipleObjectsReturned.with_traceback()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.MultipleObjectsReturned.with_traceback)
    * [`RunDocument.STRICT`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.STRICT)
    * [`RunDocument.cascade_save()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.cascade_save)
    * [`RunDocument.clean()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.clean)
    * [`RunDocument.clear_field()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.clear_field)
    * [`RunDocument.compare_indexes()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.compare_indexes)
    * [`RunDocument.copy()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.copy)
    * [`RunDocument.copy_with_new_id()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.copy_with_new_id)
    * [`RunDocument.create_index()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.create_index)
    * [`RunDocument.delete()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.delete)
    * [`RunDocument.drop_collection()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.drop_collection)
    * [`RunDocument.ensure_indexes()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.ensure_indexes)
    * [`RunDocument.fancy_repr()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.fancy_repr)
    * [`RunDocument.field_names`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.field_names)
    * [`RunDocument.field_to_mongo()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.field_to_mongo)
    * [`RunDocument.field_to_python()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.field_to_python)
    * [`RunDocument.from_dict()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.from_dict)
    * [`RunDocument.from_json()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.from_json)
    * [`RunDocument.get_field()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.get_field)
    * [`RunDocument.get_text_score()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.get_text_score)
    * [`RunDocument.has_field()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.has_field)
    * [`RunDocument.id`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.id)
    * [`RunDocument.in_db`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.in_db)
    * [`RunDocument.iter_fields()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.iter_fields)
    * [`RunDocument.list_indexes()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.list_indexes)
    * [`RunDocument.merge()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.merge)
    * [`RunDocument.modify()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.modify)
    * [`RunDocument.my_metaclass`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.my_metaclass)
    * [`RunDocument.pk`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.pk)
    * [`RunDocument.register_delete_rule()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.register_delete_rule)
    * [`RunDocument.reload()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.reload)
    * [`RunDocument.save()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.save)
    * [`RunDocument.select_related()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.select_related)
    * [`RunDocument.set_field()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.set_field)
    * [`RunDocument.switch_collection()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.switch_collection)
    * [`RunDocument.switch_db()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.switch_db)
    * [`RunDocument.to_dbref()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.to_dbref)
    * [`RunDocument.to_dict()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.to_dict)
    * [`RunDocument.to_json()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.to_json)
    * [`RunDocument.to_mongo()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.to_mongo)
    * [`RunDocument.update()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.update)
    * [`RunDocument.validate()`](fiftyone.core.odm.runs.md#fiftyone.core.odm.runs.RunDocument.validate)
* [fiftyone.core.odm.sample](fiftyone.core.odm.sample.md)
  * [`DatasetSampleDocument`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument)
    * [`DatasetSampleDocument.id`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.id)
    * [`DatasetSampleDocument.filepath`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.filepath)
    * [`DatasetSampleDocument.media_reference`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.media_reference)
    * [`DatasetSampleDocument.tags`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.tags)
    * [`DatasetSampleDocument.metadata`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.metadata)
    * [`DatasetSampleDocument.created_at`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.created_at)
    * [`DatasetSampleDocument.last_modified_at`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.last_modified_at)
    * [`DatasetSampleDocument.media_type`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.media_type)
    * [`DatasetSampleDocument.clean()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.clean)
    * [`DatasetSampleDocument.STRICT`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.STRICT)
    * [`DatasetSampleDocument.add_field()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.add_field)
    * [`DatasetSampleDocument.add_implied_field()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.add_implied_field)
    * [`DatasetSampleDocument.cascade_save()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.cascade_save)
    * [`DatasetSampleDocument.clear_field()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.clear_field)
    * [`DatasetSampleDocument.collection_name`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.collection_name)
    * [`DatasetSampleDocument.compare_indexes()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.compare_indexes)
    * [`DatasetSampleDocument.copy()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.copy)
    * [`DatasetSampleDocument.copy_with_new_id()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.copy_with_new_id)
    * [`DatasetSampleDocument.create_index()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.create_index)
    * [`DatasetSampleDocument.delete()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.delete)
    * [`DatasetSampleDocument.drop_collection()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.drop_collection)
    * [`DatasetSampleDocument.ensure_indexes()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.ensure_indexes)
    * [`DatasetSampleDocument.fancy_repr()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.fancy_repr)
    * [`DatasetSampleDocument.field_names`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.field_names)
    * [`DatasetSampleDocument.field_to_mongo()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.field_to_mongo)
    * [`DatasetSampleDocument.field_to_python()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.field_to_python)
    * [`DatasetSampleDocument.from_dict()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.from_dict)
    * [`DatasetSampleDocument.from_json()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.from_json)
    * [`DatasetSampleDocument.get_field()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.get_field)
    * [`DatasetSampleDocument.get_field_schema()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.get_field_schema)
    * [`DatasetSampleDocument.get_text_score()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.get_text_score)
    * [`DatasetSampleDocument.has_field()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.has_field)
    * [`DatasetSampleDocument.in_db`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.in_db)
    * [`DatasetSampleDocument.iter_fields()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.iter_fields)
    * [`DatasetSampleDocument.list_indexes()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.list_indexes)
    * [`DatasetSampleDocument.merge()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.merge)
    * [`DatasetSampleDocument.merge_field_schema()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.merge_field_schema)
    * [`DatasetSampleDocument.modify()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.modify)
    * [`DatasetSampleDocument.my_metaclass`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.my_metaclass)
    * [`DatasetSampleDocument.pk`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.pk)
    * [`DatasetSampleDocument.register_delete_rule()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.register_delete_rule)
    * [`DatasetSampleDocument.reload()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.reload)
    * [`DatasetSampleDocument.save()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.save)
    * [`DatasetSampleDocument.select_related()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.select_related)
    * [`DatasetSampleDocument.set_field()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.set_field)
    * [`DatasetSampleDocument.switch_collection()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.switch_collection)
    * [`DatasetSampleDocument.switch_db()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.switch_db)
    * [`DatasetSampleDocument.to_dbref()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.to_dbref)
    * [`DatasetSampleDocument.to_dict()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.to_dict)
    * [`DatasetSampleDocument.to_json()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.to_json)
    * [`DatasetSampleDocument.to_mongo()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.to_mongo)
    * [`DatasetSampleDocument.update()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.update)
    * [`DatasetSampleDocument.validate()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.DatasetSampleDocument.validate)
  * [`NoDatasetSampleDocument`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument)
    * [`NoDatasetSampleDocument.default_fields`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.default_fields)
    * [`NoDatasetSampleDocument.default_fields_ordered`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.default_fields_ordered)
    * [`NoDatasetSampleDocument.media_type`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.media_type)
    * [`NoDatasetSampleDocument.clear_field()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.clear_field)
    * [`NoDatasetSampleDocument.copy()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.copy)
    * [`NoDatasetSampleDocument.delete()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.delete)
    * [`NoDatasetSampleDocument.fancy_repr()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.fancy_repr)
    * [`NoDatasetSampleDocument.field_names`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.field_names)
    * [`NoDatasetSampleDocument.from_dict()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.from_dict)
    * [`NoDatasetSampleDocument.from_json()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.from_json)
    * [`NoDatasetSampleDocument.get_field()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.get_field)
    * [`NoDatasetSampleDocument.has_field()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.has_field)
    * [`NoDatasetSampleDocument.in_db`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.in_db)
    * [`NoDatasetSampleDocument.iter_fields()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.iter_fields)
    * [`NoDatasetSampleDocument.merge()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.merge)
    * [`NoDatasetSampleDocument.reload()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.reload)
    * [`NoDatasetSampleDocument.save()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.save)
    * [`NoDatasetSampleDocument.set_field()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.set_field)
    * [`NoDatasetSampleDocument.to_dict()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.to_dict)
    * [`NoDatasetSampleDocument.to_json()`](fiftyone.core.odm.sample.md#fiftyone.core.odm.sample.NoDatasetSampleDocument.to_json)
* [fiftyone.core.odm.utils](fiftyone.core.odm.utils.md)
  * [`serialize_value()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.serialize_value)
  * [`deserialize_value()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.deserialize_value)
  * [`validate_field_name()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.validate_field_name)
  * [`warn_reserved_pk_paths()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.warn_reserved_pk_paths)
  * [`create_field()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.create_field)
  * [`create_implied_field()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.create_implied_field)
  * [`get_field_kwargs()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.get_field_kwargs)
  * [`get_implied_field_kwargs()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.get_implied_field_kwargs)
  * [`validate_fields_match()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.validate_fields_match)
  * [`DocumentRegistry`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.DocumentRegistry)
  * [`DocumentRegistryError`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.DocumentRegistryError)
    * [`DocumentRegistryError.add_note()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.DocumentRegistryError.add_note)
    * [`DocumentRegistryError.args`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.DocumentRegistryError.args)
    * [`DocumentRegistryError.with_traceback()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.DocumentRegistryError.with_traceback)
  * [`load_dataset()`](fiftyone.core.odm.utils.md#fiftyone.core.odm.utils.load_dataset)
* [fiftyone.core.odm.views](fiftyone.core.odm.views.md)
  * [`SavedViewDocument`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument)
    * [`SavedViewDocument.dataset_id`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.dataset_id)
    * [`SavedViewDocument.name`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.name)
    * [`SavedViewDocument.description`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.description)
    * [`SavedViewDocument.slug`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.slug)
    * [`SavedViewDocument.color`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.color)
    * [`SavedViewDocument.view_stages`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.view_stages)
    * [`SavedViewDocument.created_at`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.created_at)
    * [`SavedViewDocument.last_modified_at`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.last_modified_at)
    * [`SavedViewDocument.last_loaded_at`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.last_loaded_at)
    * [`SavedViewDocument.DoesNotExist`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.DoesNotExist)
      * [`SavedViewDocument.DoesNotExist.add_note()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.DoesNotExist.add_note)
      * [`SavedViewDocument.DoesNotExist.args`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.DoesNotExist.args)
      * [`SavedViewDocument.DoesNotExist.with_traceback()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.DoesNotExist.with_traceback)
    * [`SavedViewDocument.MultipleObjectsReturned`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.MultipleObjectsReturned)
      * [`SavedViewDocument.MultipleObjectsReturned.add_note()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.MultipleObjectsReturned.add_note)
      * [`SavedViewDocument.MultipleObjectsReturned.args`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.MultipleObjectsReturned.args)
      * [`SavedViewDocument.MultipleObjectsReturned.with_traceback()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.MultipleObjectsReturned.with_traceback)
    * [`SavedViewDocument.STRICT`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.STRICT)
    * [`SavedViewDocument.cascade_save()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.cascade_save)
    * [`SavedViewDocument.clean()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.clean)
    * [`SavedViewDocument.clear_field()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.clear_field)
    * [`SavedViewDocument.compare_indexes()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.compare_indexes)
    * [`SavedViewDocument.copy()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.copy)
    * [`SavedViewDocument.copy_with_new_id()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.copy_with_new_id)
    * [`SavedViewDocument.create_index()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.create_index)
    * [`SavedViewDocument.delete()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.delete)
    * [`SavedViewDocument.drop_collection()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.drop_collection)
    * [`SavedViewDocument.ensure_indexes()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.ensure_indexes)
    * [`SavedViewDocument.fancy_repr()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.fancy_repr)
    * [`SavedViewDocument.field_names`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.field_names)
    * [`SavedViewDocument.field_to_mongo()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.field_to_mongo)
    * [`SavedViewDocument.field_to_python()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.field_to_python)
    * [`SavedViewDocument.from_dict()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.from_dict)
    * [`SavedViewDocument.from_json()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.from_json)
    * [`SavedViewDocument.get_field()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.get_field)
    * [`SavedViewDocument.get_text_score()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.get_text_score)
    * [`SavedViewDocument.has_field()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.has_field)
    * [`SavedViewDocument.id`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.id)
    * [`SavedViewDocument.in_db`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.in_db)
    * [`SavedViewDocument.iter_fields()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.iter_fields)
    * [`SavedViewDocument.list_indexes()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.list_indexes)
    * [`SavedViewDocument.merge()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.merge)
    * [`SavedViewDocument.modify()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.modify)
    * [`SavedViewDocument.my_metaclass`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.my_metaclass)
    * [`SavedViewDocument.pk`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.pk)
    * [`SavedViewDocument.register_delete_rule()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.register_delete_rule)
    * [`SavedViewDocument.reload()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.reload)
    * [`SavedViewDocument.save()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.save)
    * [`SavedViewDocument.select_related()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.select_related)
    * [`SavedViewDocument.set_field()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.set_field)
    * [`SavedViewDocument.switch_collection()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.switch_collection)
    * [`SavedViewDocument.switch_db()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.switch_db)
    * [`SavedViewDocument.to_dbref()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.to_dbref)
    * [`SavedViewDocument.to_dict()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.to_dict)
    * [`SavedViewDocument.to_json()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.to_json)
    * [`SavedViewDocument.to_mongo()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.to_mongo)
    * [`SavedViewDocument.update()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.update)
    * [`SavedViewDocument.validate()`](fiftyone.core.odm.views.md#fiftyone.core.odm.views.SavedViewDocument.validate)
* [fiftyone.core.odm.workspace](fiftyone.core.odm.workspace.md)
  * [`AppComponent`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent)
    * [`AppComponent.component_id`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.component_id)
    * [`AppComponent.STRICT`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.STRICT)
    * [`AppComponent.clean()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.clean)
    * [`AppComponent.clear_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.clear_field)
    * [`AppComponent.copy()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.copy)
    * [`AppComponent.fancy_repr()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.fancy_repr)
    * [`AppComponent.field_names`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.field_names)
    * [`AppComponent.field_to_mongo()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.field_to_mongo)
    * [`AppComponent.field_to_python()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.field_to_python)
    * [`AppComponent.from_dict()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.from_dict)
    * [`AppComponent.from_json()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.from_json)
    * [`AppComponent.get_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.get_field)
    * [`AppComponent.get_text_score()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.get_text_score)
    * [`AppComponent.has_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.has_field)
    * [`AppComponent.iter_fields()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.iter_fields)
    * [`AppComponent.merge()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.merge)
    * [`AppComponent.my_metaclass`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.my_metaclass)
    * [`AppComponent.set_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.set_field)
    * [`AppComponent.to_dict()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.to_dict)
    * [`AppComponent.to_json()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.to_json)
    * [`AppComponent.to_mongo()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.to_mongo)
    * [`AppComponent.validate()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent.validate)
  * [`Panel`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel)
    * [`Panel.type`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.type)
    * [`Panel.pinned`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.pinned)
    * [`Panel.state`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.state)
    * [`Panel.STRICT`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.STRICT)
    * [`Panel.clean()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.clean)
    * [`Panel.clear_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.clear_field)
    * [`Panel.component_id`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.component_id)
    * [`Panel.copy()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.copy)
    * [`Panel.fancy_repr()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.fancy_repr)
    * [`Panel.field_names`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.field_names)
    * [`Panel.field_to_mongo()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.field_to_mongo)
    * [`Panel.field_to_python()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.field_to_python)
    * [`Panel.from_dict()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.from_dict)
    * [`Panel.from_json()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.from_json)
    * [`Panel.get_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.get_field)
    * [`Panel.get_text_score()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.get_text_score)
    * [`Panel.has_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.has_field)
    * [`Panel.iter_fields()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.iter_fields)
    * [`Panel.merge()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.merge)
    * [`Panel.my_metaclass`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.my_metaclass)
    * [`Panel.set_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.set_field)
    * [`Panel.to_dict()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.to_dict)
    * [`Panel.to_json()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.to_json)
    * [`Panel.to_mongo()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.to_mongo)
    * [`Panel.validate()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Panel.validate)
  * [`Space`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space)
    * [`Space.children`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.children)
    * [`Space.orientation`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.orientation)
    * [`Space.active_child`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.active_child)
    * [`Space.sizes`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.sizes)
    * [`Space.name`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.name)
    * [`Space.STRICT`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.STRICT)
    * [`Space.clean()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.clean)
    * [`Space.clear_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.clear_field)
    * [`Space.component_id`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.component_id)
    * [`Space.copy()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.copy)
    * [`Space.fancy_repr()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.fancy_repr)
    * [`Space.field_names`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.field_names)
    * [`Space.field_to_mongo()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.field_to_mongo)
    * [`Space.field_to_python()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.field_to_python)
    * [`Space.from_dict()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.from_dict)
    * [`Space.from_json()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.from_json)
    * [`Space.get_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.get_field)
    * [`Space.get_text_score()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.get_text_score)
    * [`Space.has_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.has_field)
    * [`Space.iter_fields()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.iter_fields)
    * [`Space.merge()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.merge)
    * [`Space.my_metaclass`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.my_metaclass)
    * [`Space.set_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.set_field)
    * [`Space.to_dict()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.to_dict)
    * [`Space.to_json()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.to_json)
    * [`Space.to_mongo()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.to_mongo)
    * [`Space.validate()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.Space.validate)
  * [`WorkspaceDocument`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument)
    * [`WorkspaceDocument.child`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.child)
    * [`WorkspaceDocument.color`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.color)
    * [`WorkspaceDocument.created_at`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.created_at)
    * [`WorkspaceDocument.dataset_id`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.dataset_id)
    * [`WorkspaceDocument.description`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.description)
    * [`WorkspaceDocument.last_loaded_at`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.last_loaded_at)
    * [`WorkspaceDocument.last_modified_at`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.last_modified_at)
    * [`WorkspaceDocument.slug`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.slug)
    * [`WorkspaceDocument.DoesNotExist`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.DoesNotExist)
      * [`WorkspaceDocument.DoesNotExist.add_note()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.DoesNotExist.add_note)
      * [`WorkspaceDocument.DoesNotExist.args`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.DoesNotExist.args)
      * [`WorkspaceDocument.DoesNotExist.with_traceback()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.DoesNotExist.with_traceback)
    * [`WorkspaceDocument.MultipleObjectsReturned`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.MultipleObjectsReturned)
      * [`WorkspaceDocument.MultipleObjectsReturned.add_note()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.MultipleObjectsReturned.add_note)
      * [`WorkspaceDocument.MultipleObjectsReturned.args`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.MultipleObjectsReturned.args)
      * [`WorkspaceDocument.MultipleObjectsReturned.with_traceback()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.MultipleObjectsReturned.with_traceback)
    * [`WorkspaceDocument.STRICT`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.STRICT)
    * [`WorkspaceDocument.cascade_save()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.cascade_save)
    * [`WorkspaceDocument.clean()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.clean)
    * [`WorkspaceDocument.clear_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.clear_field)
    * [`WorkspaceDocument.compare_indexes()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.compare_indexes)
    * [`WorkspaceDocument.copy()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.copy)
    * [`WorkspaceDocument.copy_with_new_id()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.copy_with_new_id)
    * [`WorkspaceDocument.create_index()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.create_index)
    * [`WorkspaceDocument.delete()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.delete)
    * [`WorkspaceDocument.drop_collection()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.drop_collection)
    * [`WorkspaceDocument.ensure_indexes()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.ensure_indexes)
    * [`WorkspaceDocument.fancy_repr()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.fancy_repr)
    * [`WorkspaceDocument.field_names`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.field_names)
    * [`WorkspaceDocument.field_to_mongo()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.field_to_mongo)
    * [`WorkspaceDocument.field_to_python()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.field_to_python)
    * [`WorkspaceDocument.from_dict()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.from_dict)
    * [`WorkspaceDocument.from_json()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.from_json)
    * [`WorkspaceDocument.get_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.get_field)
    * [`WorkspaceDocument.get_text_score()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.get_text_score)
    * [`WorkspaceDocument.has_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.has_field)
    * [`WorkspaceDocument.id`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.id)
    * [`WorkspaceDocument.in_db`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.in_db)
    * [`WorkspaceDocument.iter_fields()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.iter_fields)
    * [`WorkspaceDocument.list_indexes()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.list_indexes)
    * [`WorkspaceDocument.merge()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.merge)
    * [`WorkspaceDocument.modify()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.modify)
    * [`WorkspaceDocument.my_metaclass`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.my_metaclass)
    * [`WorkspaceDocument.name`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.name)
    * [`WorkspaceDocument.pk`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.pk)
    * [`WorkspaceDocument.register_delete_rule()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.register_delete_rule)
    * [`WorkspaceDocument.reload()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.reload)
    * [`WorkspaceDocument.save()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.save)
    * [`WorkspaceDocument.select_related()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.select_related)
    * [`WorkspaceDocument.set_field()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.set_field)
    * [`WorkspaceDocument.switch_collection()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.switch_collection)
    * [`WorkspaceDocument.switch_db()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.switch_db)
    * [`WorkspaceDocument.to_dbref()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.to_dbref)
    * [`WorkspaceDocument.to_dict()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.to_dict)
    * [`WorkspaceDocument.to_json()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.to_json)
    * [`WorkspaceDocument.to_mongo()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.to_mongo)
    * [`WorkspaceDocument.update()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.update)
    * [`WorkspaceDocument.validate()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.WorkspaceDocument.validate)
  * [`default_workspace_factory()`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.default_workspace_factory)

## Module contents

ODM package declaration.

Copyright 2017-2026, Voxel51, Inc.
<br/>
[voxel51.com](https://voxel51.com/)
<br/>
<br/>

**Functions:**

| [`aggregate`](#fiftyone.core.odm.aggregate)(collection, pipelines[, hints, ...])                 | Executes one or more aggregations on a collection.                                                                                       |
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| [`get_db_config`](#fiftyone.core.odm.get_db_config)()                                            | Retrieves the database config.                                                                                                           |
| [`establish_db_conn`](#fiftyone.core.odm.establish_db_conn)(config)                              | Establishes the database connection.                                                                                                     |
| [`get_db_client`](#fiftyone.core.odm.get_db_client)()                                            | Returns a database client.                                                                                                               |
| [`get_db_conn`](#fiftyone.core.odm.get_db_conn)()                                                | Returns a connection to the database.                                                                                                    |
| [`get_db_version`](#fiftyone.core.odm.get_db_version)()                                          | Returns the database version.                                                                                                            |
| [`get_async_db_client`](#fiftyone.core.odm.get_async_db_client)([use_global])                    | Returns an async database client.                                                                                                        |
| [`get_async_db_conn`](#fiftyone.core.odm.get_async_db_conn)([use_global])                        | Returns an async connection to the database.                                                                                             |
| [`drop_database`](#fiftyone.core.odm.drop_database)()                                            | Drops the database.                                                                                                                      |
| [`sync_database`](#fiftyone.core.odm.sync_database)()                                            | Syncs all pending database writes to disk.                                                                                               |
| [`list_datasets`](#fiftyone.core.odm.list_datasets)()                                            | Returns the list of available FiftyOne datasets.                                                                                         |
| [`load_dataset`](#fiftyone.core.odm.load_dataset)([id, name, reload])                            | Loads the FiftyOne dataset with the given ID or name.                                                                                    |
| [`patch_saved_views`](#fiftyone.core.odm.patch_saved_views)(dataset_name[, dry_run])             | Ensures that the saved view documents in the `views` collection for the given dataset exactly match the IDs in its dataset document.     |
| [`patch_workspaces`](#fiftyone.core.odm.patch_workspaces)(dataset_name[, dry_run])               | Ensures that the workspace documents in the `workspaces` collection for the given dataset exactly match the IDs in its dataset document. |
| [`patch_annotation_runs`](#fiftyone.core.odm.patch_annotation_runs)(dataset_name[, dry_run])     | Ensures that the annotation runs in the `runs` collection for the given dataset exactly match the values in its dataset document.        |
| [`patch_brain_runs`](#fiftyone.core.odm.patch_brain_runs)(dataset_name[, dry_run])               | Ensures that the brain method runs in the `runs` collection for the given dataset exactly match the values in its dataset document.      |
| [`patch_evaluations`](#fiftyone.core.odm.patch_evaluations)(dataset_name[, dry_run])             | Ensures that the evaluation runs in the `runs` collection for the given dataset exactly match the values in its dataset document.        |
| [`patch_runs`](#fiftyone.core.odm.patch_runs)(dataset_name[, dry_run])                           | Ensures that the runs in the `runs` collection for the given dataset exactly match the values in its dataset document.                   |
| [`delete_dataset`](#fiftyone.core.odm.delete_dataset)(name[, dry_run])                           | Deletes the dataset with the given name.                                                                                                 |
| [`delete_saved_view`](#fiftyone.core.odm.delete_saved_view)(dataset_name, view_name[, ...])      | Deletes the saved view with the given name from the dataset with the given name.                                                         |
| [`delete_saved_views`](#fiftyone.core.odm.delete_saved_views)(dataset_name[, dry_run])           | Deletes all saved views from the dataset with the given name.                                                                            |
| [`delete_workspace`](#fiftyone.core.odm.delete_workspace)(dataset_name, workspace_name)          | Deletes the workspace with the given name from the dataset with the given name.                                                          |
| [`delete_workspaces`](#fiftyone.core.odm.delete_workspaces)(dataset_name[, dry_run])             | Deletes all workspaces from the dataset with the given name.                                                                             |
| [`delete_evaluation`](#fiftyone.core.odm.delete_evaluation)(name, eval_key[, dry_run])           | Deletes the evaluation run with the given key from the dataset with the given name.                                                      |
| [`delete_evaluations`](#fiftyone.core.odm.delete_evaluations)(name[, dry_run])                   | Deletes all evaluations from the dataset with the given name.                                                                            |
| [`delete_brain_run`](#fiftyone.core.odm.delete_brain_run)(name, brain_key[, dry_run])            | Deletes the brain method run with the given key from the dataset with the given name.                                                    |
| [`delete_brain_runs`](#fiftyone.core.odm.delete_brain_runs)(name[, dry_run])                     | Deletes all brain method runs from the dataset with the given name.                                                                      |
| [`delete_run`](#fiftyone.core.odm.delete_run)(name, run_key[, dry_run])                          | Deletes the run with the given key from the dataset with the given name.                                                                 |
| [`delete_runs`](#fiftyone.core.odm.delete_runs)(name[, dry_run])                                 | Deletes all runs from the dataset with the given name.                                                                                   |
| [`drop_collection`](#fiftyone.core.odm.drop_collection)(collection_name)                         | Drops specified collection from the database.                                                                                            |
| [`drop_orphan_collections`](#fiftyone.core.odm.drop_orphan_collections)([dry_run])               | Drops all orphan collections from the database.                                                                                          |
| [`drop_orphan_saved_views`](#fiftyone.core.odm.drop_orphan_saved_views)([dry_run])               | Drops all orphan saved views from the database.                                                                                          |
| [`drop_orphan_generated_datasets`](#fiftyone.core.odm.drop_orphan_generated_datasets)([dry_run]) | Marks all orphan generated datasets as non-persistent so that they will                                                                  |
| [`drop_orphan_workspaces`](#fiftyone.core.odm.drop_orphan_workspaces)([dry_run])                 | Drops all orphan workspaces from the database.                                                                                           |
| [`drop_orphan_runs`](#fiftyone.core.odm.drop_orphan_runs)([dry_run])                             | Drops all orphan runs from the database.                                                                                                 |
| [`drop_orphan_delegated_ops`](#fiftyone.core.odm.drop_orphan_delegated_ops)([dry_run])           | Drops all orphan delegated operations from the database.                                                                                 |
| [`drop_orphan_stores`](#fiftyone.core.odm.drop_orphan_stores)([dry_run])                         | Drops all orphan execution stores from the database.                                                                                     |
| [`drop_orphan_tags`](#fiftyone.core.odm.drop_orphan_tags)([dry_run])                             | Drops all orphan tags from the database.                                                                                                 |
| [`list_collections`](#fiftyone.core.odm.list_collections)()                                      | Returns a list of all collection names in the database.                                                                                  |
| [`get_collection_stats`](#fiftyone.core.odm.get_collection_stats)(collection_name)               | Sets stats about the collection.                                                                                                         |
| [`get_indexed_values`](#fiftyone.core.odm.get_indexed_values)(collection, ...[, ...])            | Returns the values of the field(s) for all samples in the given collection that are covered by the index.                                |
| [`stream_collection`](#fiftyone.core.odm.stream_collection)(collection_name)                     | Streams the contents of the collection to stdout.                                                                                        |
| [`count_documents`](#fiftyone.core.odm.count_documents)(coll, pipeline)                          |                                                                                                                                          |
| [`export_document`](#fiftyone.core.odm.export_document)(doc, json_path)                          | Exports the document to disk in JSON format.                                                                                             |
| [`export_collection`](#fiftyone.core.odm.export_collection)(docs, json_dir_or_path[, ...])       | Exports the collection to disk in JSON format.                                                                                           |
| [`import_document`](#fiftyone.core.odm.import_document)(json_path)                               | Imports a document from JSON on disk.                                                                                                    |
| [`import_collection`](#fiftyone.core.odm.import_collection)(json_dir_or_path[, key])             | Imports the collection from JSON on disk.                                                                                                |
| [`insert_documents`](#fiftyone.core.odm.insert_documents)(docs, coll[, ordered, ...])            | Inserts documents into a collection.                                                                                                     |
| [`bulk_write`](#fiftyone.core.odm.bulk_write)(ops, coll[, ordered, batcher, ...])                | Performs a batch of write operations on a collection.                                                                                    |
| [`get_default_fields`](#fiftyone.core.odm.get_default_fields)(cls[, include_private, ...])       | Gets the default fields present on all instances of the given `DatasetMixin` class.                                                      |
| [`serialize_value`](#fiftyone.core.odm.serialize_value)(value[, extended])                       | Serializes the given value.                                                                                                              |
| [`deserialize_value`](#fiftyone.core.odm.deserialize_value)(value)                               | Deserializes the given value.                                                                                                            |
| [`validate_field_name`](#fiftyone.core.odm.validate_field_name)(field_name[, ...])               | Verifies that the given field name is valid.                                                                                             |
| [`create_field`](#fiftyone.core.odm.create_field)(name, ftype[, ...])                            | Creates the field defined by the given specification.                                                                                    |
| [`create_implied_field`](#fiftyone.core.odm.create_implied_field)(path, value[, dynamic])        | Creates the field for the given value.                                                                                                   |
| [`get_field_kwargs`](#fiftyone.core.odm.get_field_kwargs)(field)                                 | Constructs the field keyword arguments dictionary for the given field.                                                                   |
| [`get_implied_field_kwargs`](#fiftyone.core.odm.get_implied_field_kwargs)(value[, dynamic])      | Infers the field keyword arguments dictionary for a field that can hold the given value.                                                 |
| [`validate_fields_match`](#fiftyone.core.odm.validate_fields_match)(name, field, ...)            | Validates that the types of the given fields match.                                                                                      |
| [`default_workspace_factory`](#fiftyone.core.odm.default_workspace_factory)()                    | Creates a default top-level instance of [`Space`](#fiftyone.core.odm.Space)                                                              |

**Classes:**

| [`ActiveFields`](#fiftyone.core.odm.ActiveFields)(\*args, \*\*kwargs)                       | Description of active fields in the App as defined by the sidebar's checkboxes                                                                 |
|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| [`SampleFieldDocument`](#fiftyone.core.odm.SampleFieldDocument)(\*args, \*\*kwargs)         | Description of a sample field.                                                                                                                 |
| [`ColorScheme`](#fiftyone.core.odm.ColorScheme)(\*args, \*\*kwargs)                         | Description of a color scheme in the App.                                                                                                      |
| [`KeypointSkeleton`](#fiftyone.core.odm.KeypointSkeleton)(\*args, \*\*kwargs)               | Description of a keypoint skeleton.                                                                                                            |
| [`DatasetAppConfig`](#fiftyone.core.odm.DatasetAppConfig)(\*args, \*\*kwargs)               | Dataset-specific settings that customize how a dataset is visualized in the App.                                                               |
| [`DatasetDocument`](#fiftyone.core.odm.DatasetDocument)(\*\*kwargs)                         | Backing document for datasets.                                                                                                                 |
| [`SidebarGroupDocument`](#fiftyone.core.odm.SidebarGroupDocument)(\*args, \*\*kwargs)       | Description of a sidebar group in the App.                                                                                                     |
| [`Document`](#fiftyone.core.odm.Document)(\*\*kwargs)                                       | Base class for documents that are stored in a MongoDB collection.                                                                              |
| [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)()                         | Mixin for documents that can be serialized in BSON or JSON format.                                                                             |
| [`BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument)()                         | Base class for documents that are embedded within other documents and therefore are not stored in their own collection in the database.        |
| [`DynamicEmbeddedDocument`](#fiftyone.core.odm.DynamicEmbeddedDocument)(\*args, \*\*kwargs) | Base class for dynamic documents that are embedded within other documents and therefore aren't stored in their own collection in the database. |
| [`EmbeddedDocument`](#fiftyone.core.odm.EmbeddedDocument)(\*args, \*\*kwargs)               | Base class for documents that are embedded within other documents and therefore are not stored in their own collection in the database.        |
| [`DatasetFrameDocument`](#fiftyone.core.odm.DatasetFrameDocument)(\*\*kwargs)               |                                                                                                                                                |
| [`NoDatasetFrameDocument`](#fiftyone.core.odm.NoDatasetFrameDocument)(\*\*kwargs)           |                                                                                                                                                |
| [`OntologyDocument`](#fiftyone.core.odm.OntologyDocument)(\*\*kwargs)                       | Backing document for ontologies.                                                                                                               |
| [`OntologyType`](#fiftyone.core.odm.OntologyType)(\*values)                                 | Allowed values for [`OntologyDocument.type`](#fiftyone.core.odm.OntologyDocument.type) in storage and APIs.                                    |
| [`RunDocument`](#fiftyone.core.odm.RunDocument)(\*\*kwargs)                                 | Backing document for dataset runs.                                                                                                             |
| [`DatasetSampleDocument`](#fiftyone.core.odm.DatasetSampleDocument)(\*\*kwargs)             | Base class for sample documents backing samples in datasets.                                                                                   |
| [`NoDatasetSampleDocument`](#fiftyone.core.odm.NoDatasetSampleDocument)(\*\*kwargs)         | Backing document for samples that have not been added to a dataset.                                                                            |
| [`SavedViewDocument`](#fiftyone.core.odm.SavedViewDocument)(\*\*kwargs)                     | Backing document for saved views.                                                                                                              |
| [`Panel`](#fiftyone.core.odm.Panel)(\*args, \*\*kwargs)                                     | Document for a panel (tab) within a Workspace in the App.                                                                                      |
| [`Space`](#fiftyone.core.odm.Space)(\*args, \*\*kwargs)                                     | Document for configuration of a Space in the App.                                                                                              |
| [`WorkspaceDocument`](#fiftyone.core.odm.WorkspaceDocument)(\*args, \*\*kwargs)             | Document for configuration of a saved workspace in the App.                                                                                    |

**Exceptions:**

| [`DynamicEmbeddedDocumentException`](#fiftyone.core.odm.DynamicEmbeddedDocumentException)   | Exception raised when an error occurs in a dynamic document operation.   |
|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|

### fiftyone.core.odm.aggregate(collection, pipelines, hints=None, maxTimeMS=None, \_stream=False)

Executes one or more aggregations on a collection.

> Multiple aggregations are executed using multiple threads, and their
> results are returned as lists rather than cursors.
* **Parameters:**
  * **collection** – a `pymongo.collection.Collection` or
    `motor.motor_asyncio.AsyncIOMotorCollection`
  * **pipelines** – a MongoDB aggregation pipeline or a list of pipelines
  * **hints** (*None*) – a corresponding index hint or list of index hints for
    each pipeline
  * **maxTimeMS** (*None*) – max timeout for the request(s)
* **Returns:**
  - If a single pipeline is provided, a
    `pymongo.command_cursor.CommandCursor` or
    `motor.motor_asyncio.AsyncIOMotorCommandCursor` is returned
  - If multiple pipelines are provided, each cursor is extracted into
    a list and the list of lists is returned

### fiftyone.core.odm.get_db_config()

Retrieves the database config.

* **Returns:**
  a `DatabaseConfigDocument`

### fiftyone.core.odm.establish_db_conn(config)

Establishes the database connection.

If `fiftyone.config.database_uri` is defined, then we connect to that
URI. Otherwise, a [`fiftyone.core.service.DatabaseService`](fiftyone.core.service.md#fiftyone.core.service.DatabaseService) is
created.

* **Parameters:**
  **config** – a [`fiftyone.core.config.FiftyOneConfig`](fiftyone.core.config.md#fiftyone.core.config.FiftyOneConfig)
* **Raises:**
  * **ConnectionError** – if a connection to `mongod` could not be established
  * [**FiftyOneConfigError**](fiftyone.core.config.md#fiftyone.core.config.FiftyOneConfigError) – if `fiftyone.config.database_uri` is not
        defined and `mongod` could not be found
  * [**ServiceExecutableNotFound**](fiftyone.core.service.md#fiftyone.core.service.ServiceExecutableNotFound) – if
        [`fiftyone.core.service.DatabaseService`](fiftyone.core.service.md#fiftyone.core.service.DatabaseService) startup was
        attempted, but `mongod` was not found in `fiftyone.db.bin`
  * **RuntimeError** – if the `mongod` found does not meet FiftyOne’s
        requirements, or validation could not occur

### fiftyone.core.odm.get_db_client()

Returns a database client.

* **Returns:**
  a `pymongo.mongo_client.MongoClient`

### fiftyone.core.odm.get_db_conn()

Returns a connection to the database.

* **Returns:**
  a `pymongo.database.Database`

### fiftyone.core.odm.get_db_version()

Returns the database version.

* **Returns:**
  a `packaging.version.Version`

### fiftyone.core.odm.get_async_db_client(use_global=False)

Returns an async database client.

* **Parameters:**
  **use_global** – whether to use the global client singleton
* **Returns:**
  a `motor.motor_asyncio.AsyncIOMotorClient`

### fiftyone.core.odm.get_async_db_conn(use_global=False)

Returns an async connection to the database.

* **Returns:**
  a `motor.motor_asyncio.AsyncIOMotorDatabase`

### fiftyone.core.odm.drop_database()

Drops the database.

### fiftyone.core.odm.sync_database()

Syncs all pending database writes to disk.

### fiftyone.core.odm.list_datasets()

Returns the list of available FiftyOne datasets.

This is a low-level implementation of dataset listing that does not call
[`fiftyone.core.dataset.list_datasets()`](fiftyone.core.dataset.md#fiftyone.core.dataset.list_datasets), which is helpful if a
database may be corrupted.

* **Returns:**
  a list of `Dataset` names

### fiftyone.core.odm.load_dataset(id=None, name=None, reload=False)

Loads the FiftyOne dataset with the given ID or name.

* **Parameters:**
  * **id** (*None*) – the ID of the dataset
  * **name** (*None*) – the name of the dataset
  * **reload** (*False*) – whether to reload the dataset if necessary
* **Returns:**
  a [`fiftyone.core.dataset.Dataset`](fiftyone.core.dataset.md#fiftyone.core.dataset.Dataset)

### fiftyone.core.odm.patch_saved_views(dataset_name, dry_run=False)

Ensures that the saved view documents in the `views` collection for
the given dataset exactly match the IDs in its dataset document.

* **Parameters:**
  * **dataset_name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.patch_workspaces(dataset_name, dry_run=False)

Ensures that the workspace documents in the `workspaces` collection for
the given dataset exactly match the IDs in its dataset document.

* **Parameters:**
  * **dataset_name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.patch_annotation_runs(dataset_name, dry_run=False)

Ensures that the annotation runs in the `runs` collection for the
given dataset exactly match the values in its dataset document.

* **Parameters:**
  * **dataset_name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.patch_brain_runs(dataset_name, dry_run=False)

Ensures that the brain method runs in the `runs` collection for the
given dataset exactly match the values in its dataset document.

* **Parameters:**
  * **dataset_name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.patch_evaluations(dataset_name, dry_run=False)

Ensures that the evaluation runs in the `runs` collection for the
given dataset exactly match the values in its dataset document.

* **Parameters:**
  * **dataset_name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.patch_runs(dataset_name, dry_run=False)

Ensures that the runs in the `runs` collection for the given dataset
exactly match the values in its dataset document.

* **Parameters:**
  * **dataset_name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_dataset(name, dry_run=False)

Deletes the dataset with the given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset), which is helpful if a dataset’s
backing document or collections are corrupted and cannot be loaded via the
normal pathways.

* **Parameters:**
  * **name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_saved_view(dataset_name, view_name, dry_run=False)

Deletes the saved view with the given name from the dataset with the
given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset) or
`fiftyone.core.collections.SampleCollection.load_saved_view()`,
which is helpful if a dataset’s backing document or collections are
corrupted and cannot be loaded via the normal pathways.

* **Parameters:**
  * **dataset_name** – the name of the dataset
  * **view_name** – the name of the saved view
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_saved_views(dataset_name, dry_run=False)

Deletes all saved views from the dataset with the given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset) or
`fiftyone.core.collections.SampleCollection.load_saved_view()`,
which is helpful if a dataset’s backing document or collections are
corrupted and cannot be loaded via the normal pathways.

* **Parameters:**
  * **dataset_name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_workspace(dataset_name, workspace_name, dry_run=False)

Deletes the workspace with the given name from the dataset with the
given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset) or
`fiftyone.core.collections.SampleCollection.load_workspace()`,
which is helpful if a dataset’s backing document or collections are
corrupted and cannot be loaded via the normal pathways.

* **Parameters:**
  * **dataset_name** – the name of the dataset
  * **workspace_name** – the name of the workspace
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_workspaces(dataset_name, dry_run=False)

Deletes all workspaces from the dataset with the given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset) or
`fiftyone.core.collections.SampleCollection.load_workspace()`,
which is helpful if a dataset’s backing document or collections are
corrupted and cannot be loaded via the normal pathways.

* **Parameters:**
  * **dataset_name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_evaluation(name, eval_key, dry_run=False)

Deletes the evaluation run with the given key from the dataset with the
given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset) or
[`fiftyone.core.collections.SampleCollection.delete_evaluation()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.delete_evaluation),
which is helpful if a dataset’s backing document or collections are
corrupted and cannot be loaded via the normal pathways.

Note that, as this method does not load [`fiftyone.core.runs.Run`](fiftyone.core.runs.md#fiftyone.core.runs.Run)
instances, it does not call [`fiftyone.core.runs.Run.cleanup()`](fiftyone.core.runs.md#fiftyone.core.runs.Run.cleanup).

* **Parameters:**
  * **name** – the name of the dataset
  * **eval_key** – the evaluation key
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_evaluations(name, dry_run=False)

Deletes all evaluations from the dataset with the given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset) or
[`fiftyone.core.collections.SampleCollection.delete_evaluations()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.delete_evaluations),
which is helpful if a dataset’s backing document or collections are
corrupted and cannot be loaded via the normal pathways.

Note that, as this method does not load [`fiftyone.core.runs.Run`](fiftyone.core.runs.md#fiftyone.core.runs.Run)
instances, it does not call [`fiftyone.core.runs.Run.cleanup()`](fiftyone.core.runs.md#fiftyone.core.runs.Run.cleanup).

* **Parameters:**
  * **name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_brain_run(name, brain_key, dry_run=False)

Deletes the brain method run with the given key from the dataset with
the given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset) or
[`fiftyone.core.collections.SampleCollection.delete_brain_run()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.delete_brain_run),
which is helpful if a dataset’s backing document or collections are
corrupted and cannot be loaded via the normal pathways.

Note that, as this method does not load [`fiftyone.core.runs.Run`](fiftyone.core.runs.md#fiftyone.core.runs.Run)
instances, it does not call [`fiftyone.core.runs.Run.cleanup()`](fiftyone.core.runs.md#fiftyone.core.runs.Run.cleanup).

* **Parameters:**
  * **name** – the name of the dataset
  * **brain_key** – the brain key
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_brain_runs(name, dry_run=False)

Deletes all brain method runs from the dataset with the given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset) or
[`fiftyone.core.collections.SampleCollection.delete_brain_runs()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.delete_brain_runs),
which is helpful if a dataset’s backing document or collections are
corrupted and cannot be loaded via the normal pathways.

Note that, as this method does not load [`fiftyone.core.runs.Run`](fiftyone.core.runs.md#fiftyone.core.runs.Run)
instances, it does not call [`fiftyone.core.runs.Run.cleanup()`](fiftyone.core.runs.md#fiftyone.core.runs.Run.cleanup).

* **Parameters:**
  * **name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_run(name, run_key, dry_run=False)

Deletes the run with the given key from the dataset with the given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset) or
[`fiftyone.core.collections.SampleCollection.delete_run()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.delete_run), which is
helpful if a dataset’s backing document or collections are corrupted and
cannot be loaded via the normal pathways.

Note that, as this method does not load [`fiftyone.core.runs.Run`](fiftyone.core.runs.md#fiftyone.core.runs.Run)
instances, it does not call [`fiftyone.core.runs.Run.cleanup()`](fiftyone.core.runs.md#fiftyone.core.runs.Run.cleanup).

* **Parameters:**
  * **name** – the name of the dataset
  * **run_key** – the run key
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.delete_runs(name, dry_run=False)

Deletes all runs from the dataset with the given name.

This is a low-level implementation of deletion that does not call
[`fiftyone.core.dataset.load_dataset()`](fiftyone.core.dataset.md#fiftyone.core.dataset.load_dataset) or
[`fiftyone.core.collections.SampleCollection.delete_runs()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.delete_runs), which is
helpful if a dataset’s backing document or collections are corrupted and
cannot be loaded via the normal pathways.

Note that, as this method does not load [`fiftyone.core.runs.Run`](fiftyone.core.runs.md#fiftyone.core.runs.Run)
instances, it does not call [`fiftyone.core.runs.Run.cleanup()`](fiftyone.core.runs.md#fiftyone.core.runs.Run.cleanup).

* **Parameters:**
  * **name** – the name of the dataset
  * **dry_run** (*False*) – whether to log the actions that would be taken but not
    perform them

### fiftyone.core.odm.drop_collection(collection_name)

Drops specified collection from the database.

* **Parameters:**
  **collection_name** – the collection name

### fiftyone.core.odm.drop_orphan_collections(dry_run=False)

Drops all orphan collections from the database.

Orphan collections are collections that are not associated with any known
dataset or other collections used by FiftyOne.

* **Parameters:**
  **dry_run** (*False*) – whether to log the actions that would be taken but not
  perform them

### fiftyone.core.odm.drop_orphan_saved_views(dry_run=False)

Drops all orphan saved views from the database.

Orphan saved views are saved view documents that are not associated with
any known dataset or other collections used by FiftyOne.

* **Parameters:**
  **dry_run** (*False*) – whether to log the actions that would be taken but not
  perform them

### fiftyone.core.odm.drop_orphan_generated_datasets(dry_run=False)

Marks all orphan generated datasets as non-persistent so that they will
: be deleted the next time non-persistent dataset cleanup runs.

Orphan generated datasets are datasets that were originally associated with
a saved generated view that no longer exists.

* **Parameters:**
  **dry_run** (*False*) – whether to log the actions that would be taken but not
  perform them

### fiftyone.core.odm.drop_orphan_workspaces(dry_run=False)

Drops all orphan workspaces from the database.

Orphan workspaces are workspace documents that are not associated with
any known dataset or other collections used by FiftyOne.

* **Parameters:**
  **dry_run** (*False*) – whether to log the actions that would be taken but not
  perform them

### fiftyone.core.odm.drop_orphan_runs(dry_run=False)

Drops all orphan runs from the database.

Orphan runs are runs that are not associated with any known dataset or
other collections used by FiftyOne.

* **Parameters:**
  **dry_run** (*False*) – whether to log the actions that would be taken but not
  perform them

### fiftyone.core.odm.drop_orphan_delegated_ops(dry_run=False)

Drops all orphan delegated operations from the database.

Orphan delegated operations are those that are associated with a dataset
that no longer exists in the database.

* **Parameters:**
  **dry_run** (*False*) – whether to log the actions that would be taken but not
  perform them

### fiftyone.core.odm.drop_orphan_stores(dry_run=False)

Drops all orphan execution stores from the database.

Orphan stores are those that are associated with a dataset that no longer
exists in the database.

* **Parameters:**
  **dry_run** (*False*) – whether to log the actions that would be taken but not
  perform them

### fiftyone.core.odm.drop_orphan_tags(dry_run=False)

Drops all orphan tags from the database.

Orphan tags are those that are associated with a dataset that no longer
exists in the database.

* **Parameters:**
  **dry_run** (*False*) – whether to log the actions that would be taken but not
  perform them

### fiftyone.core.odm.list_collections()

Returns a list of all collection names in the database.

* **Returns:**
  a list of all collection names

### fiftyone.core.odm.get_collection_stats(collection_name)

Sets stats about the collection.

* **Parameters:**
  **collection_name** – the name of the collection
* **Returns:**
  a stats dict

### fiftyone.core.odm.get_indexed_values(collection, field_or_fields, , index_key=None, query=None, values_only=False, \_stream=False)

Returns the values of the field(s) for all samples in the given collection
that are covered by the index. Raises an error if the field is not indexed.

* **Parameters:**
  * **collection** – a `pymongo.collection.Collection` or
    `motor.motor_asyncio.AsyncIOMotorCollection`
  * **field_or_fields** – the field name or list of field names to retrieve.
  * **index_key** (*None*) – the name of the index to use. If None, the default
    index name will be constructed from the field name(s).
  * **query** (*None*) – a dict selection filter to apply when querying.
    For performance, this should only include fields that are in
    the specified index.
  * **values_only** (*False*) – whether to remove field names from the resulting list.
    If True, the field names are removed and only the values will be
    returned as a list for each sample. If False, the field names are
    preserved and the values will be returned as a dict for each sample.
* **Returns:**
  a list of values for the specified field or index keys for each sample
  sorted in the same order as the index
* **Raises:**
  **ValueError** – if the field is not indexed

### fiftyone.core.odm.stream_collection(collection_name)

Streams the contents of the collection to stdout.

* **Parameters:**
  **collection_name** – the name of the collection

### fiftyone.core.odm.count_documents(coll, pipeline)

### fiftyone.core.odm.export_document(doc, json_path)

Exports the document to disk in JSON format.

* **Parameters:**
  * **doc** – a BSON document dict
  * **json_path** – the path to write the JSON file

### fiftyone.core.odm.export_collection(docs, json_dir_or_path, key='documents', patt='{idx:06d}-{id}.json', num_docs=None, progress=None)

Exports the collection to disk in JSON format.

* **Parameters:**
  * **docs** – an iterable containing the documents to export
  * **json_dir_or_path** – the path to write a single JSON file containing the
    entire collection, or a directory in which to write per-document
    JSON files
  * **key** ( *"documents"*) – the field name under which to store the documents
    when `json_path` is a single JSON file
  * **(****"{idx** (*patt*) – 06d}-{id}.json”): a filename pattern to use when
    `json_path` is a directory. The pattern may contain `idx` to
    refer to the index of the document in `docs` or `id` to refer
    to the document’s ID
  * **num_docs** (*None*) – the total number of documents. If omitted, this must
    be computable via `len(docs)`
  * **progress** (*None*) – whether to render a progress bar (True/False), use the
    default value `fiftyone.config.show_progress_bars` (None), or a
    progress callback function to invoke instead

### fiftyone.core.odm.import_document(json_path)

Imports a document from JSON on disk.

* **Parameters:**
  **json_path** – the path to the document
* **Returns:**
  a BSON document dict

### fiftyone.core.odm.import_collection(json_dir_or_path, key='documents')

Imports the collection from JSON on disk.

* **Parameters:**
  * **json_dir_or_path** – the path to a JSON file on disk, or a directory
    containing per-document JSON files
  * **key** ( *"documents"*) – the field name under which the documents are stored
    when `json_path` is a single JSON file
* **Returns:**
  a tuple of
  - an iterable of BSON documents
  - the number of documents, if this can be known a priori

### fiftyone.core.odm.insert_documents(docs, coll, ordered=False, batcher=None, progress=None, num_docs=None)

Inserts documents into a collection.

The `_id` field of the input documents will be populated if it is not
already set.

* **Parameters:**
  * **docs** – an iterable of BSON document dicts
  * **coll** – a pymongo collection
  * **ordered** (*False*) – whether the documents must be inserted in order
  * **batcher** (*None*) – an optional [`fiftyone.core.utils.Batcher`](fiftyone.core.utils.md#fiftyone.core.utils.Batcher) class
    to use to batch the documents, or `False` to strictly insert the
    documents in a single batch. By default,
    `fiftyone.config.default_batcher` is used
  * **progress** (*None*) – whether to render a progress bar (True/False), use the
    default value `fiftyone.config.show_progress_bars` (None), or a
    progress callback function to invoke instead
  * **num_docs** (*None*) – the total number of documents. Only used when
    `progress=True`. If omitted, this will be computed via
    `len(docs)`, if possible
* **Returns:**
  a list of IDs of the inserted documents

### fiftyone.core.odm.bulk_write(ops, coll, ordered=False, batcher=None, progress=False)

Performs a batch of write operations on a collection.

* **Parameters:**
  * **ops** – a list of pymongo operations
  * **coll** – a pymongo collection
  * **ordered** (*False*) – whether the operations must be performed in order
  * **batcher** (*None*) – an optional [`fiftyone.core.utils.Batcher`](fiftyone.core.utils.md#fiftyone.core.utils.Batcher) class
    to use to batch the operations, or `False` to strictly perform
    the operations in a single batch. By default,
    `fiftyone.config.default_batcher` is used
  * **progress** (*False*) – whether to render a progress bar (True/False), use
    the default value `fiftyone.config.show_progress_bars` (None), or
    a progress callback function to invoke instead
* **Returns:**
  A list of [`pymongo.results.BulkWriteResult`](https://pymongo.readthedocs.io/en/stable/api/pymongo/results.html#pymongo.results.BulkWriteResult) objects

### *class* fiftyone.core.odm.ActiveFields(\*args, \*\*kwargs)

Bases: [`EmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument)

Description of active fields in the App as defined by the sidebar’s
checkboxes

* **Parameters:**
  * **exclude** (*None*) – whether the paths are exclusionary
  * **paths** ( *[* *]*) – the list of `field` or `embedded.field.name` paths

**Attributes:**

| [`exclude`](#fiftyone.core.odm.ActiveFields.exclude)         | A boolean field.                                                                                                             |
|--------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`paths`](#fiftyone.core.odm.ActiveFields.paths)             | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |
| [`STRICT`](#fiftyone.core.odm.ActiveFields.STRICT)           |                                                                                                                              |
| [`field_names`](#fiftyone.core.odm.ActiveFields.field_names) | An ordered tuple of the public fields of this document.                                                                      |

**Methods:**

| [`clean`](#fiftyone.core.odm.ActiveFields.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.odm.ActiveFields.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.odm.ActiveFields.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.odm.ActiveFields.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.odm.ActiveFields.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.odm.ActiveFields.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.odm.ActiveFields.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.odm.ActiveFields.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.odm.ActiveFields.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.odm.ActiveFields.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.odm.ActiveFields.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.odm.ActiveFields.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.odm.ActiveFields.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.odm.ActiveFields.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.odm.ActiveFields.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.odm.ActiveFields.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.odm.ActiveFields.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.odm.ActiveFields.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.ActiveFields.my_metaclass)   |    |
|------------------------------------------------------------------|----|

#### exclude

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### paths

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.SampleFieldDocument(\*args, \*\*kwargs)

Bases: [`EmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument)

Description of a sample field.

**Attributes:**

| [`name`](#fiftyone.core.odm.SampleFieldDocument.name)                           | A unicode string field.                                                                                                      |
|---------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`ftype`](#fiftyone.core.odm.SampleFieldDocument.ftype)                         | A unicode string field.                                                                                                      |
| [`embedded_doc_type`](#fiftyone.core.odm.SampleFieldDocument.embedded_doc_type) | A unicode string field.                                                                                                      |
| [`subfield`](#fiftyone.core.odm.SampleFieldDocument.subfield)                   | A unicode string field.                                                                                                      |
| [`fields`](#fiftyone.core.odm.SampleFieldDocument.fields)                       | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |
| [`db_field`](#fiftyone.core.odm.SampleFieldDocument.db_field)                   | A unicode string field.                                                                                                      |
| [`description`](#fiftyone.core.odm.SampleFieldDocument.description)             | A unicode string field.                                                                                                      |
| [`info`](#fiftyone.core.odm.SampleFieldDocument.info)                           | A dictionary field that wraps a standard Python dictionary.                                                                  |
| [`read_only`](#fiftyone.core.odm.SampleFieldDocument.read_only)                 | A boolean field.                                                                                                             |
| [`created_at`](#fiftyone.core.odm.SampleFieldDocument.created_at)               | A datetime field.                                                                                                            |
| [`STRICT`](#fiftyone.core.odm.SampleFieldDocument.STRICT)                       |                                                                                                                              |
| [`field_names`](#fiftyone.core.odm.SampleFieldDocument.field_names)             | An ordered tuple of the public fields of this document.                                                                      |

**Methods:**

| [`to_field`](#fiftyone.core.odm.SampleFieldDocument.to_field)()                                     | Creates the [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field) specified by this document.   |
|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`from_field`](#fiftyone.core.odm.SampleFieldDocument.from_field)(field)                            | Creates a [`SampleFieldDocument`](#fiftyone.core.odm.SampleFieldDocument) for a field.                                       |
| [`clean`](#fiftyone.core.odm.SampleFieldDocument.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                     |
| [`clear_field`](#fiftyone.core.odm.SampleFieldDocument.clear_field)(field_name)                     | Clears the field from the document.                                                                                          |
| [`copy`](#fiftyone.core.odm.SampleFieldDocument.copy)()                                             | Returns a deep copy of the document.                                                                                         |
| [`fancy_repr`](#fiftyone.core.odm.SampleFieldDocument.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                                              |
| [`field_to_mongo`](#fiftyone.core.odm.SampleFieldDocument.field_to_mongo)(field_name)               |                                                                                                                              |
| [`field_to_python`](#fiftyone.core.odm.SampleFieldDocument.field_to_python)(field_name, value)      |                                                                                                                              |
| [`from_dict`](#fiftyone.core.odm.SampleFieldDocument.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                                              |
| [`from_json`](#fiftyone.core.odm.SampleFieldDocument.from_json)(s)                                  | Loads the document from a JSON string.                                                                                       |
| [`get_field`](#fiftyone.core.odm.SampleFieldDocument.get_field)(field_name)                         | Gets the field of the document.                                                                                              |
| [`get_text_score`](#fiftyone.core.odm.SampleFieldDocument.get_text_score)()                         | Get text score from text query                                                                                               |
| [`has_field`](#fiftyone.core.odm.SampleFieldDocument.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                                               |
| [`iter_fields`](#fiftyone.core.odm.SampleFieldDocument.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                     |
| [`merge`](#fiftyone.core.odm.SampleFieldDocument.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                                                |
| [`set_field`](#fiftyone.core.odm.SampleFieldDocument.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                                   |
| [`to_dict`](#fiftyone.core.odm.SampleFieldDocument.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                                          |
| [`to_json`](#fiftyone.core.odm.SampleFieldDocument.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                                    |
| [`to_mongo`](#fiftyone.core.odm.SampleFieldDocument.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                                               |
| [`validate`](#fiftyone.core.odm.SampleFieldDocument.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                                               |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.SampleFieldDocument.my_metaclass)   |    |
|-------------------------------------------------------------------------|----|

#### name

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### ftype

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### embedded_doc_type

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### subfield

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### fields

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### db_field

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### description

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### info

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### read_only

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### created_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### to_field()

Creates the [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field) specified by this
document.

* **Returns:**
  a [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)

#### *classmethod* from_field(field)

Creates a [`SampleFieldDocument`](#fiftyone.core.odm.SampleFieldDocument) for a field.

* **Parameters:**
  **field** – a [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field) instance
* **Returns:**
  a [`SampleFieldDocument`](#fiftyone.core.odm.SampleFieldDocument)

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.ColorScheme(\*args, \*\*kwargs)

Bases: [`EmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument)

Description of a color scheme in the App.

Example:

```default
import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")

# Store a custom color scheme for a dataset
dataset.app_config.color_scheme = fo.ColorScheme(
    color_by="value",
    color_pool=[
        "#ff0000",
        "#00ff00",
        "#0000ff",
        "pink",
        "yellowgreen",
    ],
    fields=[
        {
            "path": "ground_truth",
            "fieldColor": "#ff00ff",
            "colorByAttribute": "label",
            "valueColors": [{"value": "dog", "color": "yellow"}],
            "maskTargetsColors": [
                {"intTarget": 2, "color": "#ff0000"},
                {"intTarget": 12, "color": "#99ff00"},
            ],
        }
    ],
    label_tags={
        "fieldColor": "#00ffff",
        "valueColors": [
            {"value": "correct", "color": "#ff00ff"},
            {"value": "mistake", "color": "#00ff00"},
        ],
    },
    colorscales=[
        {
            "path": "heatmap1",
            "list": [
                {"value": 0, "color": "rgb(0, 0, 255)"},
                {"value": 1, "color": "rgb(0, 255, 255)"},
            ],
        },
        {
            "path": "heatmap2",
            "name": "hsv",
        },
    ],
    multicolor_keypoints=False,
    opacity=0.5,
    show_skeletons=True,
    default_mask_targets_colors=[
        {"intTarget": 1, "color": "#FEC0AA"},
        {"intTarget": 2, "color": "#EC4E20"},
    ],
    default_colorscale={"name": "sunset", "list": None},
)

session = fo.launch_app(dataset)
```

* **Parameters:**
  * **color_by** (*None*) – whether annotations should be colored by `"field"`,
    `"value"`, or `"instance"`
  * **color_pool** (*None*) – an optional list of colors to use as a color pool
    for this dataset
  * **multicolor_keypoints** (*None*) – whether to use multiple colors for
    keypoints
  * **opacity** (*None*) – transparency of the annotation, between 0 and 1
  * **show_skeletons** (*None*) – whether to show skeletons of keypoints
  * **fields** (*None*) – 

    an optional list of dicts of per-field custom colors
    with the following keys:
    - `path` (required): the fully-qualified path to the field
      you’re customizing
    - `fieldColor` (optional): a color to assign to the field in
      the App sidebar
    - `colorByAttribute` (optional): the attribute to use to assign
      per-value colors. Only applicable when the field is an embedded
      document
    - `valueColors` (optional): a list of dicts specifying colors
      to use for individual values of this field
    - `maskTargetsColors` (optional): a list of dicts specifying
      index and color for 2D masks in the same format as described
      below for default mask targets
  * **default_mask_targets_colors** (*None*) – 

    a list of dicts with the following
    keys specifying index and color for 2D masks of the dataset. If a
    field does not have field specific mask targets colors, this list
    will be used:
    - `intTarget`: an integer target value
    - `color`: a color string

    Note that the pixel value `0` is a reserved “background” class
    that is always rendered as invisible in the App
  * **default_colorscale** (*None*) – 

    dataset default colorscale dict with the
    following keys:
    - `name` (optional): a named plotly colorscale, e.g. `"hsv"`.
      See [https://plotly.com/python/builtin-colorscales](https://plotly.com/python/builtin-colorscales)
    - `list` (optional): a list of dicts of colorscale values
      - `value`: a float number between 0 and 1. A valid list
        must have colors defined for 0 and 1
      - `color`: an RGB color string
  * **colorscales** (*None*) – 

    an optional list of dicts of per-field custom
    colorscales with the following keys:
    - `path` (required): the fully-qualified path to the field
      you’re customizing. use “dataset” if you are setting the
      default colorscale for dataset
    - `name` (optional): a named colorscale plotly recognizes
    - `list` (optional): a list of dicts of colorscale values with
      the following keys:
      - `value`: a float number between 0 and 1. A valid list
        must have colors defined for 0 and 1
      - `color`: an RGB color string
  * **label_tags** (*None*) – 

    an optional dict specifying custom colors for label
    tags with the following keys:
    - `fieldColor` (optional): a color to assign to all label tags
    - `valueColors` (optional): a list of dicts
  * **temporal_tags** (*None*) – 

    an optional dict specifying custom colors for
    temporal tags with the following keys:
    - `fieldColor` (optional): a color to assign to all temporal
      tags
    - `valueColors` (optional): a list of dicts

**Attributes:**

| [`id`](#fiftyone.core.odm.ColorScheme.id)                                                   | An Object ID field.                                                                                                          |
|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`color_pool`](#fiftyone.core.odm.ColorScheme.color_pool)                                   | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |
| [`color_by`](#fiftyone.core.odm.ColorScheme.color_by)                                       | A unicode string field.                                                                                                      |
| [`fields`](#fiftyone.core.odm.ColorScheme.fields)                                           | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |
| [`label_tags`](#fiftyone.core.odm.ColorScheme.label_tags)                                   | A dictionary field that wraps a standard Python dictionary.                                                                  |
| [`temporal_tags`](#fiftyone.core.odm.ColorScheme.temporal_tags)                             | A dictionary field that wraps a standard Python dictionary.                                                                  |
| [`multicolor_keypoints`](#fiftyone.core.odm.ColorScheme.multicolor_keypoints)               | A boolean field.                                                                                                             |
| [`opacity`](#fiftyone.core.odm.ColorScheme.opacity)                                         | A floating point number field.                                                                                               |
| [`show_skeletons`](#fiftyone.core.odm.ColorScheme.show_skeletons)                           | A boolean field.                                                                                                             |
| [`default_mask_targets_colors`](#fiftyone.core.odm.ColorScheme.default_mask_targets_colors) | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |
| [`colorscales`](#fiftyone.core.odm.ColorScheme.colorscales)                                 | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |
| [`default_colorscale`](#fiftyone.core.odm.ColorScheme.default_colorscale)                   | A dictionary field that wraps a standard Python dictionary.                                                                  |
| [`STRICT`](#fiftyone.core.odm.ColorScheme.STRICT)                                           |                                                                                                                              |
| [`field_names`](#fiftyone.core.odm.ColorScheme.field_names)                                 | An ordered tuple of the public fields of this document.                                                                      |

**Methods:**

| [`clean`](#fiftyone.core.odm.ColorScheme.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.odm.ColorScheme.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.odm.ColorScheme.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.odm.ColorScheme.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.odm.ColorScheme.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.odm.ColorScheme.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.odm.ColorScheme.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.odm.ColorScheme.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.odm.ColorScheme.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.odm.ColorScheme.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.odm.ColorScheme.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.odm.ColorScheme.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.odm.ColorScheme.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.odm.ColorScheme.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.odm.ColorScheme.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.odm.ColorScheme.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.odm.ColorScheme.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.odm.ColorScheme.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.ColorScheme.my_metaclass)   |    |
|-----------------------------------------------------------------|----|

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### color_pool

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### color_by

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### fields

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### label_tags

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### temporal_tags

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### multicolor_keypoints

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### opacity

A floating point number field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### show_skeletons

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### default_mask_targets_colors

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### colorscales

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### default_colorscale

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.KeypointSkeleton(\*args, \*\*kwargs)

Bases: [`EmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument)

Description of a keypoint skeleton.

Keypoint skeletons can be associated with
[`fiftyone.core.labels.Keypoint`](fiftyone.core.labels.md#fiftyone.core.labels.Keypoint) or
[`fiftyone.core.labels.Keypoints`](fiftyone.core.labels.md#fiftyone.core.labels.Keypoints) fields whose
[`points`](fiftyone.core.labels.md#fiftyone.core.labels.Keypoint.points) attributes all
contain a fixed number of semantically ordered points.

The `edges` argument contains lists of integer indexes that define the
connectivity of the points in the skeleton, and the optional `labels`
argument defines the label strings for each node in the skeleton.

For example, the skeleton below is defined by edges between the following
nodes:

```default
left hand <-> left shoulder <-> right shoulder <-> right hand
left eye <-> right eye <-> mouth
```

Example:

```default
import fiftyone as fo

# A skeleton for an object made of 7 points
skeleton = fo.KeypointSkeleton(
    labels=[
        "left hand" "left shoulder", "right shoulder", "right hand",
        "left eye", "right eye", "mouth",
    ],
    edges=[[0, 1, 2, 3], [4, 5, 6]],
)
```

* **Parameters:**
  * **labels** (*None*) – an optional list of label strings for each node
  * **edges** – a list of lists of integer indexes defining the connectivity
    between nodes

**Attributes:**

| [`labels`](#fiftyone.core.odm.KeypointSkeleton.labels)           | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.   |
|------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| [`edges`](#fiftyone.core.odm.KeypointSkeleton.edges)             | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.   |
| [`STRICT`](#fiftyone.core.odm.KeypointSkeleton.STRICT)           |                                                                                                                                |
| [`field_names`](#fiftyone.core.odm.KeypointSkeleton.field_names) | An ordered tuple of the public fields of this document.                                                                        |

**Methods:**

| [`clean`](#fiftyone.core.odm.KeypointSkeleton.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.odm.KeypointSkeleton.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.odm.KeypointSkeleton.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.odm.KeypointSkeleton.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.odm.KeypointSkeleton.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.odm.KeypointSkeleton.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.odm.KeypointSkeleton.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.odm.KeypointSkeleton.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.odm.KeypointSkeleton.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.odm.KeypointSkeleton.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.odm.KeypointSkeleton.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.odm.KeypointSkeleton.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.odm.KeypointSkeleton.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.odm.KeypointSkeleton.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.odm.KeypointSkeleton.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.odm.KeypointSkeleton.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.odm.KeypointSkeleton.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.odm.KeypointSkeleton.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.KeypointSkeleton.my_metaclass)   |    |
|----------------------------------------------------------------------|----|

#### labels

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### edges

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.DatasetAppConfig(\*args, \*\*kwargs)

Bases: [`EmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument)

Dataset-specific settings that customize how a dataset is visualized in
the App.

* **Parameters:**
  * **active_fields** (*None*) – an optional [`ActiveFields`](#fiftyone.core.odm.ActiveFields) dataset default
  * **color_scheme** (*None*) – an optional [`ColorScheme`](#fiftyone.core.odm.ColorScheme) dataset default
  * **disable_frame_filtering** (*False*) – whether to disable frame filtering for
    video datasets in the App’s grid view
  * **dynamic_groups_target_frame_rate** (*30*) – the target frame rate when
    rendering ordered dynamic groups of images as videos
  * **grid_media_field** ( *"filepath"*) – the default sample field from which to
    serve media in the App’s grid view
  * **media_fallback** (*False*) – whether to fall back to the default media
    field (`"filepath"`) when the alternate media field value for a
    sample is not defined
  * **media_fields** ( *[* *"filepath"* *]*) – the list of sample fields that contain
    media and should be available to choose from the App’s settings
    menus
  * **modal_media_field** ( *"filepath"*) – the default sample field from which to
    serve media in the App’s modal view
  * **plugins** ( *{}*) – 

    an optional dict mapping plugin names to plugin
    configuration dicts. Builtin plugins include:
    - `"map"`: See the [map plugin docs](../user_guide/app.md#app-map-panel) for
      supported options
    - `"point-cloud"`: See the
      [3D visualizer docs](../user_guide/app.md#app-3d-visualizer-config) for
      supported options
  * **sidebar_groups** (*None*) – an optional list of
    [`SidebarGroupDocument`](#fiftyone.core.odm.SidebarGroupDocument) describing sidebar groups to use in
    the App

**Attributes:**

| [`active_fields`](#fiftyone.core.odm.DatasetAppConfig.active_fields)                                       | A field that stores instances of a given type of [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object.   |
|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| [`color_scheme`](#fiftyone.core.odm.DatasetAppConfig.color_scheme)                                         | A field that stores instances of a given type of [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object.   |
| [`disable_frame_filtering`](#fiftyone.core.odm.DatasetAppConfig.disable_frame_filtering)                   | A boolean field.                                                                                                                               |
| [`dynamic_groups_target_frame_rate`](#fiftyone.core.odm.DatasetAppConfig.dynamic_groups_target_frame_rate) | A 32 bit integer field.                                                                                                                        |
| [`grid_media_field`](#fiftyone.core.odm.DatasetAppConfig.grid_media_field)                                 | A unicode string field.                                                                                                                        |
| [`media_fallback`](#fiftyone.core.odm.DatasetAppConfig.media_fallback)                                     | A boolean field.                                                                                                                               |
| [`media_fields`](#fiftyone.core.odm.DatasetAppConfig.media_fields)                                         | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.                   |
| [`modal_media_field`](#fiftyone.core.odm.DatasetAppConfig.modal_media_field)                               | A unicode string field.                                                                                                                        |
| [`plugins`](#fiftyone.core.odm.DatasetAppConfig.plugins)                                                   | A dictionary field that wraps a standard Python dictionary.                                                                                    |
| [`sidebar_groups`](#fiftyone.core.odm.DatasetAppConfig.sidebar_groups)                                     | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.                   |
| [`STRICT`](#fiftyone.core.odm.DatasetAppConfig.STRICT)                                                     |                                                                                                                                                |
| [`field_names`](#fiftyone.core.odm.DatasetAppConfig.field_names)                                           | An ordered tuple of the public fields of this document.                                                                                        |

**Methods:**

| [`default_active_fields`](#fiftyone.core.odm.DatasetAppConfig.default_active_fields)(sample_collection)   | Generates the default `active_fields` for the given collection.                                          |
|-----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| [`default_sidebar_groups`](#fiftyone.core.odm.DatasetAppConfig.default_sidebar_groups)(sample_collection) | Generates the default `sidebar_groups` for the given collection.                                         |
| [`is_custom`](#fiftyone.core.odm.DatasetAppConfig.is_custom)()                                            | Determines whether this app config differs from the default one.                                         |
| [`clean`](#fiftyone.core.odm.DatasetAppConfig.clean)()                                                    | Hook for doing document level data cleaning (usually validation or assignment) before validation is run. |
| [`clear_field`](#fiftyone.core.odm.DatasetAppConfig.clear_field)(field_name)                              | Clears the field from the document.                                                                      |
| [`copy`](#fiftyone.core.odm.DatasetAppConfig.copy)()                                                      | Returns a deep copy of the document.                                                                     |
| [`fancy_repr`](#fiftyone.core.odm.DatasetAppConfig.fancy_repr)([class_name, select_fields, ...])          | Generates a customizable string representation of the document.                                          |
| [`field_to_mongo`](#fiftyone.core.odm.DatasetAppConfig.field_to_mongo)(field_name)                        |                                                                                                          |
| [`field_to_python`](#fiftyone.core.odm.DatasetAppConfig.field_to_python)(field_name, value)               |                                                                                                          |
| [`from_dict`](#fiftyone.core.odm.DatasetAppConfig.from_dict)(d[, extended])                               | Loads the document from a BSON/JSON dictionary.                                                          |
| [`from_json`](#fiftyone.core.odm.DatasetAppConfig.from_json)(s)                                           | Loads the document from a JSON string.                                                                   |
| [`get_field`](#fiftyone.core.odm.DatasetAppConfig.get_field)(field_name)                                  | Gets the field of the document.                                                                          |
| [`get_text_score`](#fiftyone.core.odm.DatasetAppConfig.get_text_score)()                                  | Get text score from text query                                                                           |
| [`has_field`](#fiftyone.core.odm.DatasetAppConfig.has_field)(field_name)                                  | Determines whether the document has a field of the given name.                                           |
| [`iter_fields`](#fiftyone.core.odm.DatasetAppConfig.iter_fields)()                                        | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                 |
| [`merge`](#fiftyone.core.odm.DatasetAppConfig.merge)(doc[, merge_lists, merge_dicts, overwrite])          | Merges the contents of the given document into this document.                                            |
| [`set_field`](#fiftyone.core.odm.DatasetAppConfig.set_field)(field_name, value[, create])                 | Sets the value of a field of the document.                                                               |
| [`to_dict`](#fiftyone.core.odm.DatasetAppConfig.to_dict)([extended])                                      | Serializes this document to a BSON/JSON dictionary.                                                      |
| [`to_json`](#fiftyone.core.odm.DatasetAppConfig.to_json)([pretty_print])                                  | Serializes the document to a JSON string.                                                                |
| [`to_mongo`](#fiftyone.core.odm.DatasetAppConfig.to_mongo)(\*args, \*\*kwargs)                            | Return as SON data ready for use with MongoDB.                                                           |
| [`validate`](#fiftyone.core.odm.DatasetAppConfig.validate)([clean])                                       | Ensure that all fields' values are valid and that required fields are present.                           |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.DatasetAppConfig.my_metaclass)   |    |
|----------------------------------------------------------------------|----|

#### active_fields

A field that stores instances of a given type of
[`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object.

* **Parameters:**
  * **document_type** – the [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type
    stored in this field
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### color_scheme

A field that stores instances of a given type of
[`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object.

* **Parameters:**
  * **document_type** – the [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type
    stored in this field
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### disable_frame_filtering

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### dynamic_groups_target_frame_rate

A 32 bit integer field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### grid_media_field

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### media_fallback

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### media_fields

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### modal_media_field

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### plugins

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### sidebar_groups

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *static* default_active_fields(sample_collection)

Generates the default `active_fields` for the given collection.

Examples:

```default
import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")

active_fields = fo.DatasetAppConfig.default_active_fields(dataset)
dataset.app_config.active_fields = active_fields
print(dataset.app_config)
```

* **Parameters:**
  **sample_collection** – a
  [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection)
* **Returns:**
  an [`ActiveFields`](#fiftyone.core.odm.ActiveFields) instance

#### *static* default_sidebar_groups(sample_collection)

Generates the default `sidebar_groups` for the given collection.

Examples:

```default
import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")

sidebar_groups = fo.DatasetAppConfig.default_sidebar_groups(dataset)
dataset.app_config.sidebar_groups = sidebar_groups
print(dataset.app_config)
```

* **Parameters:**
  **sample_collection** – a
  [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection)
* **Returns:**
  a list of [`SidebarGroupDocument`](#fiftyone.core.odm.SidebarGroupDocument) instances

#### is_custom()

Determines whether this app config differs from the default one.

* **Returns:**
  True/False

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.DatasetDocument(\*\*kwargs)

Bases: [`Document`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document)

Backing document for datasets.

**Attributes:**

| [`name`](#fiftyone.core.odm.DatasetDocument.name)                                     | A unicode string field.                                                                                                                      |
|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| [`slug`](#fiftyone.core.odm.DatasetDocument.slug)                                     | A unicode string field.                                                                                                                      |
| [`version`](#fiftyone.core.odm.DatasetDocument.version)                               | A unicode string field.                                                                                                                      |
| [`created_at`](#fiftyone.core.odm.DatasetDocument.created_at)                         | A datetime field.                                                                                                                            |
| [`last_modified_at`](#fiftyone.core.odm.DatasetDocument.last_modified_at)             | A datetime field.                                                                                                                            |
| [`last_deletion_at`](#fiftyone.core.odm.DatasetDocument.last_deletion_at)             | A datetime field.                                                                                                                            |
| [`last_loaded_at`](#fiftyone.core.odm.DatasetDocument.last_loaded_at)                 | A datetime field.                                                                                                                            |
| [`sample_collection_name`](#fiftyone.core.odm.DatasetDocument.sample_collection_name) | A unicode string field.                                                                                                                      |
| [`frame_collection_name`](#fiftyone.core.odm.DatasetDocument.frame_collection_name)   | A unicode string field.                                                                                                                      |
| [`persistent`](#fiftyone.core.odm.DatasetDocument.persistent)                         | A boolean field.                                                                                                                             |
| [`media_type`](#fiftyone.core.odm.DatasetDocument.media_type)                         | A unicode string field.                                                                                                                      |
| [`group_field`](#fiftyone.core.odm.DatasetDocument.group_field)                       | A unicode string field.                                                                                                                      |
| [`group_media_types`](#fiftyone.core.odm.DatasetDocument.group_media_types)           | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`default_group_slice`](#fiftyone.core.odm.DatasetDocument.default_group_slice)       | A unicode string field.                                                                                                                      |
| [`tags`](#fiftyone.core.odm.DatasetDocument.tags)                                     | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.                 |
| [`description`](#fiftyone.core.odm.DatasetDocument.description)                       | A unicode string field.                                                                                                                      |
| [`info`](#fiftyone.core.odm.DatasetDocument.info)                                     | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`app_config`](#fiftyone.core.odm.DatasetDocument.app_config)                         | A field that stores instances of a given type of [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object. |
| [`classes`](#fiftyone.core.odm.DatasetDocument.classes)                               | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`default_classes`](#fiftyone.core.odm.DatasetDocument.default_classes)               | A `ListField` that stores class label strings.                                                                                               |
| [`mask_targets`](#fiftyone.core.odm.DatasetDocument.mask_targets)                     | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`default_mask_targets`](#fiftyone.core.odm.DatasetDocument.default_mask_targets)     | A `DictField` that stores mapping between integer keys or RGB string hex keys and string targets.                                            |
| [`skeletons`](#fiftyone.core.odm.DatasetDocument.skeletons)                           | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`default_skeleton`](#fiftyone.core.odm.DatasetDocument.default_skeleton)             | A field that stores instances of a given type of [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object. |
| [`camera_intrinsics`](#fiftyone.core.odm.DatasetDocument.camera_intrinsics)           | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`static_transforms`](#fiftyone.core.odm.DatasetDocument.static_transforms)           | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`sample_fields`](#fiftyone.core.odm.DatasetDocument.sample_fields)                   | A field that stores a list of a given type of [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) objects.   |
| [`frame_fields`](#fiftyone.core.odm.DatasetDocument.frame_fields)                     | A field that stores a list of a given type of [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) objects.   |
| [`saved_views`](#fiftyone.core.odm.DatasetDocument.saved_views)                       | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.                 |
| [`workspaces`](#fiftyone.core.odm.DatasetDocument.workspaces)                         | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.                 |
| [`annotation_runs`](#fiftyone.core.odm.DatasetDocument.annotation_runs)               | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`brain_methods`](#fiftyone.core.odm.DatasetDocument.brain_methods)                   | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`evaluations`](#fiftyone.core.odm.DatasetDocument.evaluations)                       | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`runs`](#fiftyone.core.odm.DatasetDocument.runs)                                     | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`active_label_schemas`](#fiftyone.core.odm.DatasetDocument.active_label_schemas)     | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.                 |
| [`label_schemas`](#fiftyone.core.odm.DatasetDocument.label_schemas)                   | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`frame_label_schemas`](#fiftyone.core.odm.DatasetDocument.frame_label_schemas)       | A dictionary field that wraps a standard Python dictionary.                                                                                  |
| [`STRICT`](#fiftyone.core.odm.DatasetDocument.STRICT)                                 |                                                                                                                                              |
| [`field_names`](#fiftyone.core.odm.DatasetDocument.field_names)                       | An ordered tuple of the public fields of this document.                                                                                      |
| [`id`](#fiftyone.core.odm.DatasetDocument.id)                                         | A field wrapper around MongoDB's ObjectIds.                                                                                                  |
| [`in_db`](#fiftyone.core.odm.DatasetDocument.in_db)                                   | Whether the document has been inserted into the database.                                                                                    |
| [`pk`](#fiftyone.core.odm.DatasetDocument.pk)                                         | Get the primary key.                                                                                                                         |

**Methods:**

| [`get_stored_label_schema`](#fiftyone.core.odm.DatasetDocument.get_stored_label_schema)(field)                   | Returns the stored label schema for a field path, or `None`.                                                                                                                                     |
|------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`set_stored_label_schema`](#fiftyone.core.odm.DatasetDocument.set_stored_label_schema)(field, label_schema)     | Stores the label schema for a field path in the right store.                                                                                                                                     |
| [`all_stored_label_schemas`](#fiftyone.core.odm.DatasetDocument.all_stored_label_schemas)()                      | Returns all stored label schemas keyed by full path, with frame schemas re-keyed to their `frames.<field>` path.                                                                                 |
| [`set_all_stored_label_schemas`](#fiftyone.core.odm.DatasetDocument.set_all_stored_label_schemas)(label_schemas) | Replaces all stored label schemas from a full-path-keyed dict, splitting frame paths into the frame schema store.                                                                                |
| [`get_saved_views`](#fiftyone.core.odm.DatasetDocument.get_saved_views)()                                        |                                                                                                                                                                                                  |
| [`get_workspaces`](#fiftyone.core.odm.DatasetDocument.get_workspaces)()                                          |                                                                                                                                                                                                  |
| [`get_annotation_runs`](#fiftyone.core.odm.DatasetDocument.get_annotation_runs)()                                |                                                                                                                                                                                                  |
| [`get_brain_methods`](#fiftyone.core.odm.DatasetDocument.get_brain_methods)()                                    |                                                                                                                                                                                                  |
| [`get_evaluations`](#fiftyone.core.odm.DatasetDocument.get_evaluations)()                                        |                                                                                                                                                                                                  |
| [`get_runs`](#fiftyone.core.odm.DatasetDocument.get_runs)()                                                      |                                                                                                                                                                                                  |
| [`cascade_save`](#fiftyone.core.odm.DatasetDocument.cascade_save)(\*\*kwargs)                                    | Recursively save any references and generic references on the document.                                                                                                                          |
| [`clean`](#fiftyone.core.odm.DatasetDocument.clean)()                                                            | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                                                                         |
| [`clear_field`](#fiftyone.core.odm.DatasetDocument.clear_field)(field_name)                                      | Clears the field from the document.                                                                                                                                                              |
| [`compare_indexes`](#fiftyone.core.odm.DatasetDocument.compare_indexes)()                                        | Compares the indexes defined in MongoEngine with the ones existing in the database.                                                                                                              |
| [`copy`](#fiftyone.core.odm.DatasetDocument.copy)([new_id])                                                      | Returns a deep copy of the document.                                                                                                                                                             |
| [`copy_with_new_id`](#fiftyone.core.odm.DatasetDocument.copy_with_new_id)()                                      |                                                                                                                                                                                                  |
| [`create_index`](#fiftyone.core.odm.DatasetDocument.create_index)(keys[, background])                            | Creates the given indexes if required.                                                                                                                                                           |
| [`delete`](#fiftyone.core.odm.DatasetDocument.delete)([signal_kwargs])                                           | Delete the `Document` from the database.                                                                                                                                                         |
| [`drop_collection`](#fiftyone.core.odm.DatasetDocument.drop_collection)()                                        | Drops the entire collection associated with this `Document` type from the database.                                                                                                              |
| [`ensure_indexes`](#fiftyone.core.odm.DatasetDocument.ensure_indexes)()                                          | Checks the document meta data and ensures all the indexes exist.                                                                                                                                 |
| [`fancy_repr`](#fiftyone.core.odm.DatasetDocument.fancy_repr)([class_name, select_fields, ...])                  | Generates a customizable string representation of the document.                                                                                                                                  |
| [`field_to_mongo`](#fiftyone.core.odm.DatasetDocument.field_to_mongo)(field_name)                                |                                                                                                                                                                                                  |
| [`field_to_python`](#fiftyone.core.odm.DatasetDocument.field_to_python)(field_name, value)                       |                                                                                                                                                                                                  |
| [`from_dict`](#fiftyone.core.odm.DatasetDocument.from_dict)(d[, extended])                                       | Loads the document from a BSON/JSON dictionary.                                                                                                                                                  |
| [`from_json`](#fiftyone.core.odm.DatasetDocument.from_json)(s)                                                   | Loads the document from a JSON string.                                                                                                                                                           |
| [`get_field`](#fiftyone.core.odm.DatasetDocument.get_field)(field_name)                                          | Gets the field of the document.                                                                                                                                                                  |
| [`get_text_score`](#fiftyone.core.odm.DatasetDocument.get_text_score)()                                          | Get text score from text query                                                                                                                                                                   |
| [`has_field`](#fiftyone.core.odm.DatasetDocument.has_field)(field_name)                                          | Determines whether the document has a field of the given name.                                                                                                                                   |
| [`iter_fields`](#fiftyone.core.odm.DatasetDocument.iter_fields)()                                                | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                                                                         |
| [`list_indexes`](#fiftyone.core.odm.DatasetDocument.list_indexes)()                                              | Lists all indexes that should be created for the Document collection.                                                                                                                            |
| [`merge`](#fiftyone.core.odm.DatasetDocument.merge)(doc[, merge_lists, merge_dicts, overwrite])                  | Merges the contents of the given document into this document.                                                                                                                                    |
| [`modify`](#fiftyone.core.odm.DatasetDocument.modify)([query])                                                   | Perform an atomic update of the document in the database and reload the document object using updated version.                                                                                   |
| [`register_delete_rule`](#fiftyone.core.odm.DatasetDocument.register_delete_rule)(document_cls, ...)             | This method registers the delete rules to apply when removing this object.                                                                                                                       |
| [`reload`](#fiftyone.core.odm.DatasetDocument.reload)(\*fields, \*\*kwargs)                                      | Reloads the document from the database.                                                                                                                                                          |
| [`save`](#fiftyone.core.odm.DatasetDocument.save)([upsert, validate, safe])                                      | Saves the document to the database.                                                                                                                                                              |
| [`select_related`](#fiftyone.core.odm.DatasetDocument.select_related)([max_depth])                               | Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to a maximum depth in order to cut down the number queries to mongodb. |
| [`set_field`](#fiftyone.core.odm.DatasetDocument.set_field)(field_name, value[, create])                         | Sets the value of a field of the document.                                                                                                                                                       |
| [`switch_collection`](#fiftyone.core.odm.DatasetDocument.switch_collection)(collection_name[, ...])              | Temporarily switch the collection for a document instance.                                                                                                                                       |
| [`switch_db`](#fiftyone.core.odm.DatasetDocument.switch_db)(db_alias[, keep_created])                            | Temporarily switch the database for a document instance.                                                                                                                                         |
| [`to_dbref`](#fiftyone.core.odm.DatasetDocument.to_dbref)()                                                      | Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in `__raw__` queries.                                                     |
| [`to_dict`](#fiftyone.core.odm.DatasetDocument.to_dict)(\*args[, no_dereference])                                | Serializes this document to a BSON/JSON dictionary.                                                                                                                                              |
| [`to_json`](#fiftyone.core.odm.DatasetDocument.to_json)([pretty_print])                                          | Serializes the document to a JSON string.                                                                                                                                                        |
| [`to_mongo`](#fiftyone.core.odm.DatasetDocument.to_mongo)(\*args, \*\*kwargs)                                    | Return as SON data ready for use with MongoDB.                                                                                                                                                   |
| [`update`](#fiftyone.core.odm.DatasetDocument.update)(\*\*kwargs)                                                | Performs an update on the `Document` A convenience wrapper to `update()`.                                                                                                                        |
| [`validate`](#fiftyone.core.odm.DatasetDocument.validate)([clean])                                               | Ensure that all fields' values are valid and that required fields are present.                                                                                                                   |

**Miscellaneous:**

| [`DoesNotExist`](#fiftyone.core.odm.DatasetDocument.DoesNotExist)                       |    |
|-----------------------------------------------------------------------------------------|----|
| [`MultipleObjectsReturned`](#fiftyone.core.odm.DatasetDocument.MultipleObjectsReturned) |    |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.DatasetDocument.my_metaclass)   |    |
|---------------------------------------------------------------------|----|

#### name

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### slug

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### version

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### created_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### last_modified_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### last_deletion_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### last_loaded_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### sample_collection_name

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### frame_collection_name

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### persistent

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### media_type

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### group_field

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### group_media_types

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### default_group_slice

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### description

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### info

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### app_config

A field that stores instances of a given type of
[`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object.

* **Parameters:**
  * **document_type** – the [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type
    stored in this field
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### classes

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### default_classes

A `ListField` that stores class label strings.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### mask_targets

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### default_mask_targets

A `DictField` that stores mapping between integer keys or RGB
string hex keys and string targets.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### skeletons

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### default_skeleton

A field that stores instances of a given type of
[`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object.

* **Parameters:**
  * **document_type** – the [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type
    stored in this field
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### camera_intrinsics

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### static_transforms

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### sample_fields

A field that stores a list of a given type of
[`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) objects.

* **Parameters:**
  * **document_type** – the [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type
    stored in this field
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### frame_fields

A field that stores a list of a given type of
[`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) objects.

* **Parameters:**
  * **document_type** – the [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type
    stored in this field
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### saved_views

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### workspaces

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### annotation_runs

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### brain_methods

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### evaluations

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### runs

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### active_label_schemas

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### label_schemas

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### frame_label_schemas

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### get_stored_label_schema(field)

Returns the stored label schema for a field path, or `None`.

#### set_stored_label_schema(field, label_schema)

Stores the label schema for a field path in the right store.

#### all_stored_label_schemas()

Returns all stored label schemas keyed by full path, with frame
schemas re-keyed to their `frames.<field>` path.

#### set_all_stored_label_schemas(label_schemas)

Replaces all stored label schemas from a full-path-keyed dict,
splitting frame paths into the frame schema store.

#### get_saved_views()

#### get_workspaces()

#### get_annotation_runs()

#### get_brain_methods()

#### get_evaluations()

#### get_runs()

#### *exception* DoesNotExist

Bases: `DoesNotExist`

**Methods:**

| [`add_note`](#fiftyone.core.odm.DatasetDocument.DoesNotExist.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.DatasetDocument.DoesNotExist.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.DatasetDocument.DoesNotExist.args)   |    |
|------------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

#### *exception* MultipleObjectsReturned

Bases: `MultipleObjectsReturned`

**Methods:**

| [`add_note`](#fiftyone.core.odm.DatasetDocument.MultipleObjectsReturned.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.DatasetDocument.MultipleObjectsReturned.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.DatasetDocument.MultipleObjectsReturned.args)   |    |
|-----------------------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

#### STRICT *= False*

#### cascade_save(\*\*kwargs)

Recursively save any references and generic references on the
document.

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### *classmethod* compare_indexes()

Compares the indexes defined in MongoEngine with the ones
existing in the database. Returns any missing/extra indexes.

#### copy(new_id=False)

Returns a deep copy of the document.

* **Parameters:**
  **new_id** (*False*) – whether to generate a new ID for the copied
  document. By default, the ID is left as `None` and will be
  automatically populated when the document is added to the
  database

#### copy_with_new_id()

#### *classmethod* create_index(keys, background=False, \*\*kwargs)

Creates the given indexes if required.

* **Parameters:**
  * **keys** – a single index key or a list of index keys (to
    construct a multi-field index); keys may be prefixed with a **+**
    or a **-** to determine the index ordering
  * **background** – Allows index creation in the background

#### delete(signal_kwargs=None, \*\*write_concern)

Delete the `Document` from the database. This
will only take effect if the document has been previously saved.

* **Parameters:**
  * **signal_kwargs** – (optional) kwargs dictionary to be passed to
    the signal calls.
  * **write_concern** – Extra keyword arguments are passed down which
    will be used as options for the resultant `getLastError` command.
    For example, `save(..., w: 2, fsync: True)` will
    wait until at least two servers have recorded the write and
    will force an fsync on the primary server.

#### *classmethod* drop_collection()

Drops the entire collection associated with this
`Document` type from the database.

Raises `OperationError` if the document has no collection set
(i.g. if it is `abstract`)

#### *classmethod* ensure_indexes()

Checks the document meta data and ensures all the indexes exist.

Global defaults can be set in the meta - see guide/defining-documents

By default, this will get called automatically upon first interaction with the
Document collection (query, save, etc) so unless you disabled `auto_create_index`, you
shouldn’t have to call this manually.

This also gets called upon every call to Document.save if `auto_create_index_on_save` is set to True

If called multiple times, MongoDB will not re-recreate indexes if they exist already

#### NOTE
You can disable automatic index creation by setting
`auto_create_index` to False in the documents meta data

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

A field wrapper around MongoDB’s ObjectIds.

#### *property* in_db

Whether the document has been inserted into the database.

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### *classmethod* list_indexes()

Lists all indexes that should be created for the Document collection.
It includes all the indexes from super- and sub-classes.

Note that it will only return the indexes’ fields, not the indexes’ options

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### modify(query=None, \*\*update)

Perform an atomic update of the document in the database and reload
the document object using updated version.

Returns True if the document has been updated or False if the document
in the database doesn’t match the query.

#### NOTE
All unsaved changes that have been made to the document are
rejected if the method returns True.

* **Parameters:**
  * **query** – the update will be performed only if the document in the
    database matches the query
  * **update** – Django-style update keyword arguments

#### my_metaclass

alias of `TopLevelDocumentMetaclass`

#### *property* pk

Get the primary key.

#### *classmethod* register_delete_rule(document_cls, field_name, rule)

This method registers the delete rules to apply when removing this
object.

#### reload(\*fields, \*\*kwargs)

Reloads the document from the database.

* **Parameters:**
  **\*fields** – an optional args list of specific fields to reload

#### save(upsert=False, validate=True, safe=False, \*\*kwargs)

Saves the document to the database.

If the document already exists, it will be updated, otherwise it will
be created.

* **Parameters:**
  * **upsert** (*False*) – whether to insert the document if it has an `id`
    populated but no document with that ID exists in the database
  * **validate** (*True*) – whether to validate the document
  * **safe** (*False*) – whether to `reload()` the document before raising
    any errors
* **Returns:**
  self

#### select_related(max_depth=1)

Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to
a maximum depth in order to cut down the number queries to mongodb.

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### switch_collection(collection_name, keep_created=True)

Temporarily switch the collection for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_collection('old-users')
user.save()
```

* **Parameters:**
  * **collection_name** (*str*) – The database alias to use for saving the
    document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching collection, else is reset to True

#### SEE ALSO
Use `switch_db`
if you need to read from another database

#### switch_db(db_alias, keep_created=True)

Temporarily switch the database for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_db('archive-db')
user.save()
```

* **Parameters:**
  * **db_alias** (*str*) – The database alias to use for saving the document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching db, else is reset to True

#### SEE ALSO
Use `switch_collection`
if you need to read from another collection

#### to_dbref()

Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in
`__raw__` queries.

#### to_dict(\*args, no_dereference=False, \*\*kwargs)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### update(\*\*kwargs)

Performs an update on the `Document`
A convenience wrapper to `update()`.

Raises `OperationError` if called on an object that has not yet
been saved.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.SidebarGroupDocument(\*args, \*\*kwargs)

Bases: [`EmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.EmbeddedDocument)

Description of a sidebar group in the App.

* **Parameters:**
  * **name** – the name of the sidebar group
  * **paths** ( *[* *]*) – the list of `field` or `embedded.field.name` paths in
    the group
  * **expanded** (*None*) – whether this group should be expanded by default

**Attributes:**

| [`name`](#fiftyone.core.odm.SidebarGroupDocument.name)               | A unicode string field.                                                                                                      |
|----------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`paths`](#fiftyone.core.odm.SidebarGroupDocument.paths)             | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |
| [`expanded`](#fiftyone.core.odm.SidebarGroupDocument.expanded)       | A boolean field.                                                                                                             |
| [`STRICT`](#fiftyone.core.odm.SidebarGroupDocument.STRICT)           |                                                                                                                              |
| [`field_names`](#fiftyone.core.odm.SidebarGroupDocument.field_names) | An ordered tuple of the public fields of this document.                                                                      |

**Methods:**

| [`clean`](#fiftyone.core.odm.SidebarGroupDocument.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.odm.SidebarGroupDocument.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.odm.SidebarGroupDocument.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.odm.SidebarGroupDocument.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.odm.SidebarGroupDocument.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.odm.SidebarGroupDocument.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.odm.SidebarGroupDocument.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.odm.SidebarGroupDocument.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.odm.SidebarGroupDocument.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.odm.SidebarGroupDocument.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.odm.SidebarGroupDocument.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.odm.SidebarGroupDocument.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.odm.SidebarGroupDocument.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.odm.SidebarGroupDocument.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.odm.SidebarGroupDocument.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.odm.SidebarGroupDocument.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.odm.SidebarGroupDocument.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.odm.SidebarGroupDocument.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.SidebarGroupDocument.my_metaclass)   |    |
|--------------------------------------------------------------------------|----|

#### name

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### paths

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### expanded

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.Document(\*\*kwargs)

Bases: [`BaseDocument`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.BaseDocument), `Document`

Base class for documents that are stored in a MongoDB collection.

The ID of a document is automatically populated when it is added to the
database, and the ID of a document is `None` if it has not been added to
the database.

#### id

the ID of the document, or `None` if it has not been added to the
database

**Methods:**

| [`copy`](#fiftyone.core.odm.Document.copy)([new_id])                                          | Returns a deep copy of the document.                                                                                                                                                             |
|-----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`reload`](#fiftyone.core.odm.Document.reload)(\*fields, \*\*kwargs)                          | Reloads the document from the database.                                                                                                                                                          |
| [`save`](#fiftyone.core.odm.Document.save)([upsert, validate, safe])                          | Saves the document to the database.                                                                                                                                                              |
| [`copy_with_new_id`](#fiftyone.core.odm.Document.copy_with_new_id)()                          |                                                                                                                                                                                                  |
| [`cascade_save`](#fiftyone.core.odm.Document.cascade_save)(\*\*kwargs)                        | Recursively save any references and generic references on the document.                                                                                                                          |
| [`clean`](#fiftyone.core.odm.Document.clean)()                                                | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                                                                         |
| [`clear_field`](#fiftyone.core.odm.Document.clear_field)(field_name)                          | Clears the field from the document.                                                                                                                                                              |
| [`compare_indexes`](#fiftyone.core.odm.Document.compare_indexes)()                            | Compares the indexes defined in MongoEngine with the ones existing in the database.                                                                                                              |
| [`create_index`](#fiftyone.core.odm.Document.create_index)(keys[, background])                | Creates the given indexes if required.                                                                                                                                                           |
| [`delete`](#fiftyone.core.odm.Document.delete)([signal_kwargs])                               | Delete the `Document` from the database.                                                                                                                                                         |
| [`drop_collection`](#fiftyone.core.odm.Document.drop_collection)()                            | Drops the entire collection associated with this `Document` type from the database.                                                                                                              |
| [`ensure_indexes`](#fiftyone.core.odm.Document.ensure_indexes)()                              | Checks the document meta data and ensures all the indexes exist.                                                                                                                                 |
| [`fancy_repr`](#fiftyone.core.odm.Document.fancy_repr)([class_name, select_fields, ...])      | Generates a customizable string representation of the document.                                                                                                                                  |
| [`field_to_mongo`](#fiftyone.core.odm.Document.field_to_mongo)(field_name)                    |                                                                                                                                                                                                  |
| [`field_to_python`](#fiftyone.core.odm.Document.field_to_python)(field_name, value)           |                                                                                                                                                                                                  |
| [`from_dict`](#fiftyone.core.odm.Document.from_dict)(d[, extended])                           | Loads the document from a BSON/JSON dictionary.                                                                                                                                                  |
| [`from_json`](#fiftyone.core.odm.Document.from_json)(s)                                       | Loads the document from a JSON string.                                                                                                                                                           |
| [`get_field`](#fiftyone.core.odm.Document.get_field)(field_name)                              | Gets the field of the document.                                                                                                                                                                  |
| [`get_text_score`](#fiftyone.core.odm.Document.get_text_score)()                              | Get text score from text query                                                                                                                                                                   |
| [`has_field`](#fiftyone.core.odm.Document.has_field)(field_name)                              | Determines whether the document has a field of the given name.                                                                                                                                   |
| [`iter_fields`](#fiftyone.core.odm.Document.iter_fields)()                                    | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                                                                         |
| [`list_indexes`](#fiftyone.core.odm.Document.list_indexes)()                                  | Lists all indexes that should be created for the Document collection.                                                                                                                            |
| [`merge`](#fiftyone.core.odm.Document.merge)(doc[, merge_lists, merge_dicts, overwrite])      | Merges the contents of the given document into this document.                                                                                                                                    |
| [`modify`](#fiftyone.core.odm.Document.modify)([query])                                       | Perform an atomic update of the document in the database and reload the document object using updated version.                                                                                   |
| [`register_delete_rule`](#fiftyone.core.odm.Document.register_delete_rule)(document_cls, ...) | This method registers the delete rules to apply when removing this object.                                                                                                                       |
| [`select_related`](#fiftyone.core.odm.Document.select_related)([max_depth])                   | Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to a maximum depth in order to cut down the number queries to mongodb. |
| [`set_field`](#fiftyone.core.odm.Document.set_field)(field_name, value[, create])             | Sets the value of a field of the document.                                                                                                                                                       |
| [`switch_collection`](#fiftyone.core.odm.Document.switch_collection)(collection_name[, ...])  | Temporarily switch the collection for a document instance.                                                                                                                                       |
| [`switch_db`](#fiftyone.core.odm.Document.switch_db)(db_alias[, keep_created])                | Temporarily switch the database for a document instance.                                                                                                                                         |
| [`to_dbref`](#fiftyone.core.odm.Document.to_dbref)()                                          | Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in `__raw__` queries.                                                     |
| [`to_dict`](#fiftyone.core.odm.Document.to_dict)([extended])                                  | Serializes this document to a BSON/JSON dictionary.                                                                                                                                              |
| [`to_json`](#fiftyone.core.odm.Document.to_json)([pretty_print])                              | Serializes the document to a JSON string.                                                                                                                                                        |
| [`to_mongo`](#fiftyone.core.odm.Document.to_mongo)(\*args, \*\*kwargs)                        | Return as SON data ready for use with MongoDB.                                                                                                                                                   |
| [`update`](#fiftyone.core.odm.Document.update)(\*\*kwargs)                                    | Performs an update on the `Document` A convenience wrapper to `update()`.                                                                                                                        |
| [`validate`](#fiftyone.core.odm.Document.validate)([clean])                                   | Ensure that all fields' values are valid and that required fields are present.                                                                                                                   |

**Attributes:**

| [`STRICT`](#fiftyone.core.odm.Document.STRICT)           |                                                           |
|----------------------------------------------------------|-----------------------------------------------------------|
| [`field_names`](#fiftyone.core.odm.Document.field_names) | An ordered tuple of the public fields of this document.   |
| [`in_db`](#fiftyone.core.odm.Document.in_db)             | Whether the document has been inserted into the database. |
| [`pk`](#fiftyone.core.odm.Document.pk)                   | Get the primary key.                                      |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.Document.my_metaclass)   |    |
|--------------------------------------------------------------|----|

#### copy(new_id=False)

Returns a deep copy of the document.

* **Parameters:**
  **new_id** (*False*) – whether to generate a new ID for the copied
  document. By default, the ID is left as `None` and will be
  automatically populated when the document is added to the
  database

#### reload(\*fields, \*\*kwargs)

Reloads the document from the database.

* **Parameters:**
  **\*fields** – an optional args list of specific fields to reload

#### save(upsert=False, validate=True, safe=False, \*\*kwargs)

Saves the document to the database.

If the document already exists, it will be updated, otherwise it will
be created.

* **Parameters:**
  * **upsert** (*False*) – whether to insert the document if it has an `id`
    populated but no document with that ID exists in the database
  * **validate** (*True*) – whether to validate the document
  * **safe** (*False*) – whether to `reload()` the document before raising
    any errors
* **Returns:**
  self

#### copy_with_new_id()

#### STRICT *= False*

#### cascade_save(\*\*kwargs)

Recursively save any references and generic references on the
document.

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### *classmethod* compare_indexes()

Compares the indexes defined in MongoEngine with the ones
existing in the database. Returns any missing/extra indexes.

#### *classmethod* create_index(keys, background=False, \*\*kwargs)

Creates the given indexes if required.

* **Parameters:**
  * **keys** – a single index key or a list of index keys (to
    construct a multi-field index); keys may be prefixed with a **+**
    or a **-** to determine the index ordering
  * **background** – Allows index creation in the background

#### delete(signal_kwargs=None, \*\*write_concern)

Delete the `Document` from the database. This
will only take effect if the document has been previously saved.

* **Parameters:**
  * **signal_kwargs** – (optional) kwargs dictionary to be passed to
    the signal calls.
  * **write_concern** – Extra keyword arguments are passed down which
    will be used as options for the resultant `getLastError` command.
    For example, `save(..., w: 2, fsync: True)` will
    wait until at least two servers have recorded the write and
    will force an fsync on the primary server.

#### *classmethod* drop_collection()

Drops the entire collection associated with this
`Document` type from the database.

Raises `OperationError` if the document has no collection set
(i.g. if it is `abstract`)

#### *classmethod* ensure_indexes()

Checks the document meta data and ensures all the indexes exist.

Global defaults can be set in the meta - see guide/defining-documents

By default, this will get called automatically upon first interaction with the
Document collection (query, save, etc) so unless you disabled `auto_create_index`, you
shouldn’t have to call this manually.

This also gets called upon every call to Document.save if `auto_create_index_on_save` is set to True

If called multiple times, MongoDB will not re-recreate indexes if they exist already

#### NOTE
You can disable automatic index creation by setting
`auto_create_index` to False in the documents meta data

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### *property* in_db

Whether the document has been inserted into the database.

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### *classmethod* list_indexes()

Lists all indexes that should be created for the Document collection.
It includes all the indexes from super- and sub-classes.

Note that it will only return the indexes’ fields, not the indexes’ options

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### modify(query=None, \*\*update)

Perform an atomic update of the document in the database and reload
the document object using updated version.

Returns True if the document has been updated or False if the document
in the database doesn’t match the query.

#### NOTE
All unsaved changes that have been made to the document are
rejected if the method returns True.

* **Parameters:**
  * **query** – the update will be performed only if the document in the
    database matches the query
  * **update** – Django-style update keyword arguments

#### my_metaclass

alias of `TopLevelDocumentMetaclass`

#### *property* pk

Get the primary key.

#### *classmethod* register_delete_rule(document_cls, field_name, rule)

This method registers the delete rules to apply when removing this
object.

#### select_related(max_depth=1)

Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to
a maximum depth in order to cut down the number queries to mongodb.

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### switch_collection(collection_name, keep_created=True)

Temporarily switch the collection for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_collection('old-users')
user.save()
```

* **Parameters:**
  * **collection_name** (*str*) – The database alias to use for saving the
    document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching collection, else is reset to True

#### SEE ALSO
Use `switch_db`
if you need to read from another database

#### switch_db(db_alias, keep_created=True)

Temporarily switch the database for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_db('archive-db')
user.save()
```

* **Parameters:**
  * **db_alias** (*str*) – The database alias to use for saving the document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching db, else is reset to True

#### SEE ALSO
Use `switch_collection`
if you need to read from another collection

#### to_dbref()

Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in
`__raw__` queries.

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### update(\*\*kwargs)

Performs an update on the `Document`
A convenience wrapper to `update()`.

Raises `OperationError` if called on an object that has not yet
been saved.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.SerializableDocument

Bases: `object`

Mixin for documents that can be serialized in BSON or JSON format.

**Attributes:**

| [`field_names`](#fiftyone.core.odm.SerializableDocument.field_names)   | An ordered tuple of the public fields of this document.   |
|------------------------------------------------------------------------|-----------------------------------------------------------|

**Methods:**

| [`fancy_repr`](#fiftyone.core.odm.SerializableDocument.fancy_repr)([class_name, select_fields, ...])   | Generates a customizable string representation of the document.                          |
|--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| [`has_field`](#fiftyone.core.odm.SerializableDocument.has_field)(field_name)                           | Determines whether the document has a field of the given name.                           |
| [`get_field`](#fiftyone.core.odm.SerializableDocument.get_field)(field_name)                           | Gets the field of the document.                                                          |
| [`set_field`](#fiftyone.core.odm.SerializableDocument.set_field)(field_name, value[, create])          | Sets the value of a field of the document.                                               |
| [`clear_field`](#fiftyone.core.odm.SerializableDocument.clear_field)(field_name)                       | Clears the field from the document.                                                      |
| [`iter_fields`](#fiftyone.core.odm.SerializableDocument.iter_fields)()                                 | Returns an iterator over the `(name, value)` pairs of the public fields of the document. |
| [`copy`](#fiftyone.core.odm.SerializableDocument.copy)()                                               | Returns a deep copy of the document.                                                     |
| [`merge`](#fiftyone.core.odm.SerializableDocument.merge)(doc[, merge_lists, merge_dicts, overwrite])   | Merges the contents of the given document into this document.                            |
| [`to_dict`](#fiftyone.core.odm.SerializableDocument.to_dict)([extended])                               | Serializes this document to a BSON/JSON dictionary.                                      |
| [`from_dict`](#fiftyone.core.odm.SerializableDocument.from_dict)(d[, extended])                        | Loads the document from a BSON/JSON dictionary.                                          |
| [`to_json`](#fiftyone.core.odm.SerializableDocument.to_json)([pretty_print])                           | Serializes the document to a JSON string.                                                |
| [`from_json`](#fiftyone.core.odm.SerializableDocument.from_json)(s)                                    | Loads the document from a JSON string.                                                   |

#### *property* field_names

An ordered tuple of the public fields of this document.

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

### *class* fiftyone.core.odm.BaseEmbeddedDocument

Bases: [`MongoEngineBaseDocument`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.MongoEngineBaseDocument)

Base class for documents that are embedded within other documents and
therefore are not stored in their own collection in the database.

**Methods:**

| [`clear_field`](#fiftyone.core.odm.BaseEmbeddedDocument.clear_field)(field_name)                     | Clears the field from the document.                                                      |
|------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| [`copy`](#fiftyone.core.odm.BaseEmbeddedDocument.copy)()                                             | Returns a deep copy of the document.                                                     |
| [`fancy_repr`](#fiftyone.core.odm.BaseEmbeddedDocument.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                          |
| [`field_to_mongo`](#fiftyone.core.odm.BaseEmbeddedDocument.field_to_mongo)(field_name)               |                                                                                          |
| [`field_to_python`](#fiftyone.core.odm.BaseEmbeddedDocument.field_to_python)(field_name, value)      |                                                                                          |
| [`from_dict`](#fiftyone.core.odm.BaseEmbeddedDocument.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                          |
| [`from_json`](#fiftyone.core.odm.BaseEmbeddedDocument.from_json)(s)                                  | Loads the document from a JSON string.                                                   |
| [`get_field`](#fiftyone.core.odm.BaseEmbeddedDocument.get_field)(field_name)                         | Gets the field of the document.                                                          |
| [`has_field`](#fiftyone.core.odm.BaseEmbeddedDocument.has_field)(field_name)                         | Determines whether the document has a field of the given name.                           |
| [`iter_fields`](#fiftyone.core.odm.BaseEmbeddedDocument.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document. |
| [`merge`](#fiftyone.core.odm.BaseEmbeddedDocument.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                            |
| [`set_field`](#fiftyone.core.odm.BaseEmbeddedDocument.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                               |
| [`to_dict`](#fiftyone.core.odm.BaseEmbeddedDocument.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                      |
| [`to_json`](#fiftyone.core.odm.BaseEmbeddedDocument.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                |

**Attributes:**

| [`field_names`](#fiftyone.core.odm.BaseEmbeddedDocument.field_names)   | An ordered tuple of the public fields of this document.   |
|------------------------------------------------------------------------|-----------------------------------------------------------|

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

### *class* fiftyone.core.odm.DynamicEmbeddedDocument(\*args, \*\*kwargs)

Bases: [`DynamicMixin`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.DynamicMixin), [`BaseEmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument), `DynamicEmbeddedDocument`

Base class for dynamic documents that are embedded within other
documents and therefore aren’t stored in their own collection in the
database.

Dynamic documents can have arbitrary fields added to them.

**Attributes:**

| [`STRICT`](#fiftyone.core.odm.DynamicEmbeddedDocument.STRICT)           |                                                         |
|-------------------------------------------------------------------------|---------------------------------------------------------|
| [`field_names`](#fiftyone.core.odm.DynamicEmbeddedDocument.field_names) | An ordered tuple of the public fields of this document. |

**Methods:**

| [`clean`](#fiftyone.core.odm.DynamicEmbeddedDocument.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.odm.DynamicEmbeddedDocument.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.odm.DynamicEmbeddedDocument.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.odm.DynamicEmbeddedDocument.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.odm.DynamicEmbeddedDocument.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.odm.DynamicEmbeddedDocument.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.odm.DynamicEmbeddedDocument.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.odm.DynamicEmbeddedDocument.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.odm.DynamicEmbeddedDocument.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.odm.DynamicEmbeddedDocument.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.odm.DynamicEmbeddedDocument.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.odm.DynamicEmbeddedDocument.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.odm.DynamicEmbeddedDocument.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.odm.DynamicEmbeddedDocument.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.odm.DynamicEmbeddedDocument.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.odm.DynamicEmbeddedDocument.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.odm.DynamicEmbeddedDocument.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.odm.DynamicEmbeddedDocument.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.DynamicEmbeddedDocument.my_metaclass)   |    |
|-----------------------------------------------------------------------------|----|

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *exception* fiftyone.core.odm.DynamicEmbeddedDocumentException

Bases: `Exception`

Exception raised when an error occurs in a dynamic document operation.

**Methods:**

| [`add_note`](#fiftyone.core.odm.DynamicEmbeddedDocumentException.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.DynamicEmbeddedDocumentException.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.DynamicEmbeddedDocumentException.args)   |    |
|----------------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

### *class* fiftyone.core.odm.EmbeddedDocument(\*args, \*\*kwargs)

Bases: [`BaseEmbeddedDocument`](fiftyone.core.odm.embedded_document.md#fiftyone.core.odm.embedded_document.BaseEmbeddedDocument), `EmbeddedDocument`

Base class for documents that are embedded within other documents and
therefore are not stored in their own collection in the database.

**Attributes:**

| [`STRICT`](#fiftyone.core.odm.EmbeddedDocument.STRICT)           |                                                         |
|------------------------------------------------------------------|---------------------------------------------------------|
| [`field_names`](#fiftyone.core.odm.EmbeddedDocument.field_names) | An ordered tuple of the public fields of this document. |

**Methods:**

| [`clean`](#fiftyone.core.odm.EmbeddedDocument.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.odm.EmbeddedDocument.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.odm.EmbeddedDocument.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.odm.EmbeddedDocument.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.odm.EmbeddedDocument.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.odm.EmbeddedDocument.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.odm.EmbeddedDocument.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.odm.EmbeddedDocument.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.odm.EmbeddedDocument.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.odm.EmbeddedDocument.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.odm.EmbeddedDocument.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.odm.EmbeddedDocument.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.odm.EmbeddedDocument.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.odm.EmbeddedDocument.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.odm.EmbeddedDocument.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.odm.EmbeddedDocument.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.odm.EmbeddedDocument.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.odm.EmbeddedDocument.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.EmbeddedDocument.my_metaclass)   |    |
|----------------------------------------------------------------------|----|

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.DatasetFrameDocument(\*\*kwargs)

Bases: [`DatasetMixin`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin), [`Document`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document)

**Attributes:**

| [`id`](#fiftyone.core.odm.DatasetFrameDocument.id)                             | An Object ID field.                                       |
|--------------------------------------------------------------------------------|-----------------------------------------------------------|
| [`frame_number`](#fiftyone.core.odm.DatasetFrameDocument.frame_number)         | A video frame number field.                               |
| [`created_at`](#fiftyone.core.odm.DatasetFrameDocument.created_at)             | A datetime field.                                         |
| [`last_modified_at`](#fiftyone.core.odm.DatasetFrameDocument.last_modified_at) | A datetime field.                                         |
| [`STRICT`](#fiftyone.core.odm.DatasetFrameDocument.STRICT)                     |                                                           |
| [`collection_name`](#fiftyone.core.odm.DatasetFrameDocument.collection_name)   |                                                           |
| [`field_names`](#fiftyone.core.odm.DatasetFrameDocument.field_names)           | An ordered tuple of the public fields of this document.   |
| [`in_db`](#fiftyone.core.odm.DatasetFrameDocument.in_db)                       | Whether the document has been inserted into the database. |
| [`pk`](#fiftyone.core.odm.DatasetFrameDocument.pk)                             | Get the primary key.                                      |

**Methods:**

| [`add_field`](#fiftyone.core.odm.DatasetFrameDocument.add_field)(path, ftype[, embedded_doc_type, ...])          | Adds a new field or embedded field to the document, if necessary.                                                                                                                                |
|------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`add_implied_field`](#fiftyone.core.odm.DatasetFrameDocument.add_implied_field)(path, value[, ...])             | Adds the field or embedded field to the document, if necessary, inferring the field type from the provided value.                                                                                |
| [`cascade_save`](#fiftyone.core.odm.DatasetFrameDocument.cascade_save)(\*\*kwargs)                               | Recursively save any references and generic references on the document.                                                                                                                          |
| [`clean`](#fiftyone.core.odm.DatasetFrameDocument.clean)()                                                       | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                                                                         |
| [`clear_field`](#fiftyone.core.odm.DatasetFrameDocument.clear_field)(field_name)                                 | Clears the field from the document.                                                                                                                                                              |
| [`compare_indexes`](#fiftyone.core.odm.DatasetFrameDocument.compare_indexes)()                                   | Compares the indexes defined in MongoEngine with the ones existing in the database.                                                                                                              |
| [`copy`](#fiftyone.core.odm.DatasetFrameDocument.copy)([new_id])                                                 | Returns a deep copy of the document.                                                                                                                                                             |
| [`copy_with_new_id`](#fiftyone.core.odm.DatasetFrameDocument.copy_with_new_id)()                                 |                                                                                                                                                                                                  |
| [`create_index`](#fiftyone.core.odm.DatasetFrameDocument.create_index)(keys[, background])                       | Creates the given indexes if required.                                                                                                                                                           |
| [`delete`](#fiftyone.core.odm.DatasetFrameDocument.delete)([signal_kwargs])                                      | Delete the `Document` from the database.                                                                                                                                                         |
| [`drop_collection`](#fiftyone.core.odm.DatasetFrameDocument.drop_collection)()                                   | Drops the entire collection associated with this `Document` type from the database.                                                                                                              |
| [`ensure_indexes`](#fiftyone.core.odm.DatasetFrameDocument.ensure_indexes)()                                     | Checks the document meta data and ensures all the indexes exist.                                                                                                                                 |
| [`fancy_repr`](#fiftyone.core.odm.DatasetFrameDocument.fancy_repr)([class_name, select_fields, ...])             | Generates a customizable string representation of the document.                                                                                                                                  |
| [`field_to_mongo`](#fiftyone.core.odm.DatasetFrameDocument.field_to_mongo)(field_name)                           |                                                                                                                                                                                                  |
| [`field_to_python`](#fiftyone.core.odm.DatasetFrameDocument.field_to_python)(field_name, value)                  |                                                                                                                                                                                                  |
| [`from_dict`](#fiftyone.core.odm.DatasetFrameDocument.from_dict)(d[, extended])                                  | Loads the document from a BSON/JSON dictionary.                                                                                                                                                  |
| [`from_json`](#fiftyone.core.odm.DatasetFrameDocument.from_json)(s)                                              | Loads the document from a JSON string.                                                                                                                                                           |
| [`get_field`](#fiftyone.core.odm.DatasetFrameDocument.get_field)(field_name)                                     | Gets the field of the document.                                                                                                                                                                  |
| [`get_field_schema`](#fiftyone.core.odm.DatasetFrameDocument.get_field_schema)([ftype, embedded_doc_type, ...])  | Returns a schema dictionary describing the fields of this document.                                                                                                                              |
| [`get_text_score`](#fiftyone.core.odm.DatasetFrameDocument.get_text_score)()                                     | Get text score from text query                                                                                                                                                                   |
| [`has_field`](#fiftyone.core.odm.DatasetFrameDocument.has_field)(field_name)                                     | Determines whether the document has a field of the given name.                                                                                                                                   |
| [`iter_fields`](#fiftyone.core.odm.DatasetFrameDocument.iter_fields)()                                           | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                                                                         |
| [`list_indexes`](#fiftyone.core.odm.DatasetFrameDocument.list_indexes)()                                         | Lists all indexes that should be created for the Document collection.                                                                                                                            |
| [`merge`](#fiftyone.core.odm.DatasetFrameDocument.merge)(doc[, merge_lists, merge_dicts, overwrite])             | Merges the contents of the given document into this document.                                                                                                                                    |
| [`merge_field_schema`](#fiftyone.core.odm.DatasetFrameDocument.merge_field_schema)(schema[, expand_schema, ...]) | Merges the field schema into this document.                                                                                                                                                      |
| [`modify`](#fiftyone.core.odm.DatasetFrameDocument.modify)([query])                                              | Perform an atomic update of the document in the database and reload the document object using updated version.                                                                                   |
| [`register_delete_rule`](#fiftyone.core.odm.DatasetFrameDocument.register_delete_rule)(document_cls, ...)        | This method registers the delete rules to apply when removing this object.                                                                                                                       |
| [`reload`](#fiftyone.core.odm.DatasetFrameDocument.reload)(\*fields, \*\*kwargs)                                 | Reloads the document from the database.                                                                                                                                                          |
| [`save`](#fiftyone.core.odm.DatasetFrameDocument.save)([upsert, validate, safe])                                 | Saves the document to the database.                                                                                                                                                              |
| [`select_related`](#fiftyone.core.odm.DatasetFrameDocument.select_related)([max_depth])                          | Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to a maximum depth in order to cut down the number queries to mongodb. |
| [`set_field`](#fiftyone.core.odm.DatasetFrameDocument.set_field)(field_name, value[, create, ...])               | Sets the value of a field of the document.                                                                                                                                                       |
| [`switch_collection`](#fiftyone.core.odm.DatasetFrameDocument.switch_collection)(collection_name[, ...])         | Temporarily switch the collection for a document instance.                                                                                                                                       |
| [`switch_db`](#fiftyone.core.odm.DatasetFrameDocument.switch_db)(db_alias[, keep_created])                       | Temporarily switch the database for a document instance.                                                                                                                                         |
| [`to_dbref`](#fiftyone.core.odm.DatasetFrameDocument.to_dbref)()                                                 | Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in `__raw__` queries.                                                     |
| [`to_dict`](#fiftyone.core.odm.DatasetFrameDocument.to_dict)([extended])                                         | Serializes this document to a BSON/JSON dictionary.                                                                                                                                              |
| [`to_json`](#fiftyone.core.odm.DatasetFrameDocument.to_json)([pretty_print])                                     | Serializes the document to a JSON string.                                                                                                                                                        |
| [`to_mongo`](#fiftyone.core.odm.DatasetFrameDocument.to_mongo)(\*args, \*\*kwargs)                               | Return as SON data ready for use with MongoDB.                                                                                                                                                   |
| [`update`](#fiftyone.core.odm.DatasetFrameDocument.update)(\*\*kwargs)                                           | Performs an update on the `Document` A convenience wrapper to `update()`.                                                                                                                        |
| [`validate`](#fiftyone.core.odm.DatasetFrameDocument.validate)([clean])                                          | Ensure that all fields' values are valid and that required fields are present.                                                                                                                   |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.DatasetFrameDocument.my_metaclass)   |    |
|--------------------------------------------------------------------------|----|

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### frame_number

A video frame number field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### created_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### last_modified_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### *classmethod* add_field(path, ftype, embedded_doc_type=None, subfield=None, fields=None, description=None, info=None, read_only=False, expand_schema=True, recursive=True, validate=True, \*\*kwargs)

Adds a new field or embedded field to the document, if necessary.

* **Parameters:**
  * **path** – the field name or `embedded.field.name`
  * **ftype** – the field type to create. Must be a subclass of
    [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
  * **embedded_doc_type** (*None*) – the
    [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type of the
    field. Only applicable when `ftype` is
    [`fiftyone.core.fields.EmbeddedDocumentField`](fiftyone.core.fields.md#fiftyone.core.fields.EmbeddedDocumentField)
  * **subfield** (*None*) – the [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field) type of
    the contained field. Only applicable when `ftype` is
    [`fiftyone.core.fields.ListField`](fiftyone.core.fields.md#fiftyone.core.fields.ListField) or
    [`fiftyone.core.fields.DictField`](fiftyone.core.fields.md#fiftyone.core.fields.DictField)
  * **fields** (*None*) – a list of [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
    instances defining embedded document attributes. Only
    applicable when `ftype` is
    [`fiftyone.core.fields.EmbeddedDocumentField`](fiftyone.core.fields.md#fiftyone.core.fields.EmbeddedDocumentField)
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field should be read-only
  * **expand_schema** (*True*) – whether to add new fields to the schema
    (True) or simply validate that the field already exists with a
    consistent type (False)
  * **recursive** (*True*) – whether to recursively add embedded document
    fields
  * **validate** (*True*) – whether to validate the field against an existing
    field at the same path
* **Returns:**
  True/False whether one or more fields or embedded fields were added
  to the document or its children
* **Raises:**
  **ValueError** – if a field in the schema is not compliant with an
      existing field of the same name

#### *classmethod* add_implied_field(path, value, expand_schema=True, dynamic=False, recursive=True, validate=True)

Adds the field or embedded field to the document, if necessary,
inferring the field type from the provided value.

* **Parameters:**
  * **path** – the field name or `embedded.field.name`
  * **value** – the field value
  * **expand_schema** (*True*) – whether to add new fields to the schema
    (True) or simply validate that the field already exists with a
    consistent type (False)
  * **dynamic** (*False*) – whether to declare dynamic embedded document
    fields
  * **recursive** (*True*) – whether to recursively add embedded document
    fields
  * **validate** (*True*) – whether to validate the field against an existing
    field at the same path
* **Returns:**
  True/False whether one or more fields or embedded fields were added
  to the document or its children
* **Raises:**
  **ValueError** – if a field in the schema is not compliant with an
      existing field of the same name

#### cascade_save(\*\*kwargs)

Recursively save any references and generic references on the
document.

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### *property* collection_name

#### *classmethod* compare_indexes()

Compares the indexes defined in MongoEngine with the ones
existing in the database. Returns any missing/extra indexes.

#### copy(new_id=False)

Returns a deep copy of the document.

* **Parameters:**
  **new_id** (*False*) – whether to generate a new ID for the copied
  document. By default, the ID is left as `None` and will be
  automatically populated when the document is added to the
  database

#### copy_with_new_id()

#### *classmethod* create_index(keys, background=False, \*\*kwargs)

Creates the given indexes if required.

* **Parameters:**
  * **keys** – a single index key or a list of index keys (to
    construct a multi-field index); keys may be prefixed with a **+**
    or a **-** to determine the index ordering
  * **background** – Allows index creation in the background

#### delete(signal_kwargs=None, \*\*write_concern)

Delete the `Document` from the database. This
will only take effect if the document has been previously saved.

* **Parameters:**
  * **signal_kwargs** – (optional) kwargs dictionary to be passed to
    the signal calls.
  * **write_concern** – Extra keyword arguments are passed down which
    will be used as options for the resultant `getLastError` command.
    For example, `save(..., w: 2, fsync: True)` will
    wait until at least two servers have recorded the write and
    will force an fsync on the primary server.

#### *classmethod* drop_collection()

Drops the entire collection associated with this
`Document` type from the database.

Raises `OperationError` if the document has no collection set
(i.g. if it is `abstract`)

#### *classmethod* ensure_indexes()

Checks the document meta data and ensures all the indexes exist.

Global defaults can be set in the meta - see guide/defining-documents

By default, this will get called automatically upon first interaction with the
Document collection (query, save, etc) so unless you disabled `auto_create_index`, you
shouldn’t have to call this manually.

This also gets called upon every call to Document.save if `auto_create_index_on_save` is set to True

If called multiple times, MongoDB will not re-recreate indexes if they exist already

#### NOTE
You can disable automatic index creation by setting
`auto_create_index` to False in the documents meta data

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### *classmethod* get_field_schema(ftype=None, embedded_doc_type=None, subfield=None, read_only=None, info_keys=None, created_after=None, include_private=False, flat=False, unwind=True, mode=None)

Returns a schema dictionary describing the fields of this document.

If the document belongs to a dataset, the schema will apply to all
documents in the collection.

* **Parameters:**
  * **ftype** (*None*) – an optional field type or iterable of field types to
    which to restrict the returned schema. Must be subclass(es) of
    [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
  * **embedded_doc_type** (*None*) – an optional embedded document type or
    iterable of types to which to restrict the returned schema.
    Must be subclass(es) of
    [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument)
  * **subfield** (*None*) – an optional subfield type or iterable of subfield
    types to which to restrict the returned schema. Must be
    subclass(es) of [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
  * **read_only** (*None*) – whether to restrict to (True) or exclude (False)
    read-only fields. By default, all fields are included
  * **info_keys** (*None*) – an optional key or list of keys that must be in
    the field’s `info` dict
  * **created_after** (*None*) – an optional `datetime` specifying a minimum
    creation date
  * **include_private** (*False*) – whether to include fields that start with
    `_` in the returned schema
  * **flat** (*False*) – whether to return a flattened schema where all
    embedded document fields are included as top-level keys
  * **unwind** (*True*) – whether to traverse into list fields. Only
    applicable when `flat=True`
  * **mode** (*None*) – whether to apply the above constraints before and/or
    after flattening the schema. Only applicable when `flat=True`.
    Supported values are `("before", "after", "both")`. The
    default is `"after"`
* **Returns:**
  a dict mapping field names to [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
  instances

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### *property* in_db

Whether the document has been inserted into the database.

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### *classmethod* list_indexes()

Lists all indexes that should be created for the Document collection.
It includes all the indexes from super- and sub-classes.

Note that it will only return the indexes’ fields, not the indexes’ options

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### *classmethod* merge_field_schema(schema, expand_schema=True, recursive=True, validate=True, overwrite=False)

Merges the field schema into this document.

* **Parameters:**
  * **schema** – a dict mapping field names or `embedded.field.names` to
    [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field) instances
  * **expand_schema** (*True*) – whether to add new fields to the schema
    (True) or simply validate that fields already exist with
    consistent types (False)
  * **recursive** (*True*) – whether to recursively merge embedded document
    fields
  * **validate** (*True*) – whether to validate fields against existing fields
    at the same path
  * **overwrite** (*False*) – whether to overwrite the editable metadata of
    existing fields
* **Returns:**
  True/False whether any new fields were added
* **Raises:**
  **ValueError** – if a field in the schema is not compliant with an
      existing field of the same name or a new field is found but
      `expand_schema == False`

#### modify(query=None, \*\*update)

Perform an atomic update of the document in the database and reload
the document object using updated version.

Returns True if the document has been updated or False if the document
in the database doesn’t match the query.

#### NOTE
All unsaved changes that have been made to the document are
rejected if the method returns True.

* **Parameters:**
  * **query** – the update will be performed only if the document in the
    database matches the query
  * **update** – Django-style update keyword arguments

#### my_metaclass

alias of `TopLevelDocumentMetaclass`

#### *property* pk

Get the primary key.

#### *classmethod* register_delete_rule(document_cls, field_name, rule)

This method registers the delete rules to apply when removing this
object.

#### reload(\*fields, \*\*kwargs)

Reloads the document from the database.

* **Parameters:**
  **\*fields** – an optional args list of specific fields to reload

#### save(upsert=False, validate=True, safe=False, \*\*kwargs)

Saves the document to the database.

If the document already exists, it will be updated, otherwise it will
be created.

* **Parameters:**
  * **upsert** (*False*) – whether to insert the document if it has an `id`
    populated but no document with that ID exists in the database
  * **validate** (*True*) – whether to validate the document
  * **safe** (*False*) – whether to `reload()` the document before raising
    any errors
* **Returns:**
  self

#### select_related(max_depth=1)

Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to
a maximum depth in order to cut down the number queries to mongodb.

#### set_field(field_name, value, create=True, validate=True, dynamic=False, \_enforce_read_only=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### switch_collection(collection_name, keep_created=True)

Temporarily switch the collection for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_collection('old-users')
user.save()
```

* **Parameters:**
  * **collection_name** (*str*) – The database alias to use for saving the
    document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching collection, else is reset to True

#### SEE ALSO
Use `switch_db`
if you need to read from another database

#### switch_db(db_alias, keep_created=True)

Temporarily switch the database for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_db('archive-db')
user.save()
```

* **Parameters:**
  * **db_alias** (*str*) – The database alias to use for saving the document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching db, else is reset to True

#### SEE ALSO
Use `switch_collection`
if you need to read from another collection

#### to_dbref()

Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in
`__raw__` queries.

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### update(\*\*kwargs)

Performs an update on the `Document`
A convenience wrapper to `update()`.

Raises `OperationError` if called on an object that has not yet
been saved.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.NoDatasetFrameDocument(\*\*kwargs)

Bases: [`NoDatasetMixin`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin), [`SerializableDocument`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument)

**Attributes:**

| [`default_fields`](#fiftyone.core.odm.NoDatasetFrameDocument.default_fields)                 |                                                         |
|----------------------------------------------------------------------------------------------|---------------------------------------------------------|
| [`default_fields_ordered`](#fiftyone.core.odm.NoDatasetFrameDocument.default_fields_ordered) |                                                         |
| [`field_names`](#fiftyone.core.odm.NoDatasetFrameDocument.field_names)                       | An ordered tuple of the public fields of this document. |
| [`in_db`](#fiftyone.core.odm.NoDatasetFrameDocument.in_db)                                   |                                                         |

**Methods:**

| [`clear_field`](#fiftyone.core.odm.NoDatasetFrameDocument.clear_field)(field_name)                     | Clears the field from the document.                                                      |
|--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| [`copy`](#fiftyone.core.odm.NoDatasetFrameDocument.copy)()                                             | Returns a deep copy of the document.                                                     |
| [`delete`](#fiftyone.core.odm.NoDatasetFrameDocument.delete)()                                         |                                                                                          |
| [`fancy_repr`](#fiftyone.core.odm.NoDatasetFrameDocument.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                          |
| [`from_dict`](#fiftyone.core.odm.NoDatasetFrameDocument.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                          |
| [`from_json`](#fiftyone.core.odm.NoDatasetFrameDocument.from_json)(s)                                  | Loads the document from a JSON string.                                                   |
| [`get_field`](#fiftyone.core.odm.NoDatasetFrameDocument.get_field)(field_name)                         | Gets the field of the document.                                                          |
| [`has_field`](#fiftyone.core.odm.NoDatasetFrameDocument.has_field)(field_name)                         | Determines whether the document has a field of the given name.                           |
| [`iter_fields`](#fiftyone.core.odm.NoDatasetFrameDocument.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document. |
| [`merge`](#fiftyone.core.odm.NoDatasetFrameDocument.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                            |
| [`reload`](#fiftyone.core.odm.NoDatasetFrameDocument.reload)()                                         |                                                                                          |
| [`save`](#fiftyone.core.odm.NoDatasetFrameDocument.save)()                                             |                                                                                          |
| [`set_field`](#fiftyone.core.odm.NoDatasetFrameDocument.set_field)(field_name, value[, create, ...])   | Sets the value of a field of the document.                                               |
| [`to_dict`](#fiftyone.core.odm.NoDatasetFrameDocument.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                      |
| [`to_json`](#fiftyone.core.odm.NoDatasetFrameDocument.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                |

#### default_fields *= {'_dataset_id': <fiftyone.core.fields.ObjectIdField object>, '_sample_id': <fiftyone.core.fields.ObjectIdField object>, 'created_at': <fiftyone.core.fields.DateTimeField object>, 'frame_number': <fiftyone.core.fields.FrameNumberField object>, 'id': <fiftyone.core.fields.ObjectIdField object>, 'last_modified_at': <fiftyone.core.fields.DateTimeField object>}*

#### default_fields_ordered *= ('id', 'frame_number', 'created_at', 'last_modified_at', '_sample_id', '_dataset_id')*

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### delete()

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### *property* in_db

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### reload()

#### save()

#### set_field(field_name, value, create=True, validate=True, dynamic=False)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

### fiftyone.core.odm.get_default_fields(cls, include_private=False, use_db_fields=False)

Gets the default fields present on all instances of the given
`DatasetMixin` class.

* **Parameters:**
  * **cls** – the `DatasetMixin` class
  * **include_private** (*False*) – whether to include fields starting with `_`
  * **use_db_fields** (*False*) – whether to return database fields rather than
    user-facing fields, when applicable
* **Returns:**
  a tuple of field names

### *class* fiftyone.core.odm.OntologyDocument(\*\*kwargs)

Bases: [`Document`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document)

Backing document for ontologies.

Ontologies are global resources not scoped to any single dataset.
Multiple datasets can reference the same ontology by name. Each
save creates a new versioned document; `(slug, version)` is unique,
so names differing only in case or punctuation collide on save.

`schema_version` records the internal layout version of the row at
write time. Bump `CURRENT_SCHEMA_VERSION` and add a migration when
changing the persisted structure (especially `root`).

**Attributes:**

| [`name`](#fiftyone.core.odm.OntologyDocument.name)                         | A unicode string field.                                     |
|----------------------------------------------------------------------------|-------------------------------------------------------------|
| [`slug`](#fiftyone.core.odm.OntologyDocument.slug)                         | A unicode string field.                                     |
| [`version`](#fiftyone.core.odm.OntologyDocument.version)                   | A 32 bit integer field.                                     |
| [`schema_version`](#fiftyone.core.odm.OntologyDocument.schema_version)     | A 32 bit integer field.                                     |
| [`type`](#fiftyone.core.odm.OntologyDocument.type)                         | A unicode string field.                                     |
| [`description`](#fiftyone.core.odm.OntologyDocument.description)           | A unicode string field.                                     |
| [`root`](#fiftyone.core.odm.OntologyDocument.root)                         | A dictionary field that wraps a standard Python dictionary. |
| [`created_at`](#fiftyone.core.odm.OntologyDocument.created_at)             | A datetime field.                                           |
| [`last_modified_at`](#fiftyone.core.odm.OntologyDocument.last_modified_at) | A datetime field.                                           |
| [`STRICT`](#fiftyone.core.odm.OntologyDocument.STRICT)                     |                                                             |
| [`field_names`](#fiftyone.core.odm.OntologyDocument.field_names)           | An ordered tuple of the public fields of this document.     |
| [`id`](#fiftyone.core.odm.OntologyDocument.id)                             | A field wrapper around MongoDB's ObjectIds.                 |
| [`in_db`](#fiftyone.core.odm.OntologyDocument.in_db)                       | Whether the document has been inserted into the database.   |
| [`pk`](#fiftyone.core.odm.OntologyDocument.pk)                             | Get the primary key.                                        |

**Methods:**

| [`save`](#fiftyone.core.odm.OntologyDocument.save)(\*args, \*\*kwargs)                                | Saves the document to the database.                                                                                                                                                              |
|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`cascade_save`](#fiftyone.core.odm.OntologyDocument.cascade_save)(\*\*kwargs)                        | Recursively save any references and generic references on the document.                                                                                                                          |
| [`clean`](#fiftyone.core.odm.OntologyDocument.clean)()                                                | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                                                                         |
| [`clear_field`](#fiftyone.core.odm.OntologyDocument.clear_field)(field_name)                          | Clears the field from the document.                                                                                                                                                              |
| [`compare_indexes`](#fiftyone.core.odm.OntologyDocument.compare_indexes)()                            | Compares the indexes defined in MongoEngine with the ones existing in the database.                                                                                                              |
| [`copy`](#fiftyone.core.odm.OntologyDocument.copy)([new_id])                                          | Returns a deep copy of the document.                                                                                                                                                             |
| [`copy_with_new_id`](#fiftyone.core.odm.OntologyDocument.copy_with_new_id)()                          |                                                                                                                                                                                                  |
| [`create_index`](#fiftyone.core.odm.OntologyDocument.create_index)(keys[, background])                | Creates the given indexes if required.                                                                                                                                                           |
| [`delete`](#fiftyone.core.odm.OntologyDocument.delete)([signal_kwargs])                               | Delete the `Document` from the database.                                                                                                                                                         |
| [`drop_collection`](#fiftyone.core.odm.OntologyDocument.drop_collection)()                            | Drops the entire collection associated with this `Document` type from the database.                                                                                                              |
| [`ensure_indexes`](#fiftyone.core.odm.OntologyDocument.ensure_indexes)()                              | Checks the document meta data and ensures all the indexes exist.                                                                                                                                 |
| [`fancy_repr`](#fiftyone.core.odm.OntologyDocument.fancy_repr)([class_name, select_fields, ...])      | Generates a customizable string representation of the document.                                                                                                                                  |
| [`field_to_mongo`](#fiftyone.core.odm.OntologyDocument.field_to_mongo)(field_name)                    |                                                                                                                                                                                                  |
| [`field_to_python`](#fiftyone.core.odm.OntologyDocument.field_to_python)(field_name, value)           |                                                                                                                                                                                                  |
| [`from_dict`](#fiftyone.core.odm.OntologyDocument.from_dict)(d[, extended])                           | Loads the document from a BSON/JSON dictionary.                                                                                                                                                  |
| [`from_json`](#fiftyone.core.odm.OntologyDocument.from_json)(s)                                       | Loads the document from a JSON string.                                                                                                                                                           |
| [`get_field`](#fiftyone.core.odm.OntologyDocument.get_field)(field_name)                              | Gets the field of the document.                                                                                                                                                                  |
| [`get_text_score`](#fiftyone.core.odm.OntologyDocument.get_text_score)()                              | Get text score from text query                                                                                                                                                                   |
| [`has_field`](#fiftyone.core.odm.OntologyDocument.has_field)(field_name)                              | Determines whether the document has a field of the given name.                                                                                                                                   |
| [`iter_fields`](#fiftyone.core.odm.OntologyDocument.iter_fields)()                                    | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                                                                         |
| [`list_indexes`](#fiftyone.core.odm.OntologyDocument.list_indexes)()                                  | Lists all indexes that should be created for the Document collection.                                                                                                                            |
| [`merge`](#fiftyone.core.odm.OntologyDocument.merge)(doc[, merge_lists, merge_dicts, overwrite])      | Merges the contents of the given document into this document.                                                                                                                                    |
| [`modify`](#fiftyone.core.odm.OntologyDocument.modify)([query])                                       | Perform an atomic update of the document in the database and reload the document object using updated version.                                                                                   |
| [`register_delete_rule`](#fiftyone.core.odm.OntologyDocument.register_delete_rule)(document_cls, ...) | This method registers the delete rules to apply when removing this object.                                                                                                                       |
| [`reload`](#fiftyone.core.odm.OntologyDocument.reload)(\*fields, \*\*kwargs)                          | Reloads the document from the database.                                                                                                                                                          |
| [`select_related`](#fiftyone.core.odm.OntologyDocument.select_related)([max_depth])                   | Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to a maximum depth in order to cut down the number queries to mongodb. |
| [`set_field`](#fiftyone.core.odm.OntologyDocument.set_field)(field_name, value[, create])             | Sets the value of a field of the document.                                                                                                                                                       |
| [`switch_collection`](#fiftyone.core.odm.OntologyDocument.switch_collection)(collection_name[, ...])  | Temporarily switch the collection for a document instance.                                                                                                                                       |
| [`switch_db`](#fiftyone.core.odm.OntologyDocument.switch_db)(db_alias[, keep_created])                | Temporarily switch the database for a document instance.                                                                                                                                         |
| [`to_dbref`](#fiftyone.core.odm.OntologyDocument.to_dbref)()                                          | Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in `__raw__` queries.                                                     |
| [`to_dict`](#fiftyone.core.odm.OntologyDocument.to_dict)([extended])                                  | Serializes this document to a BSON/JSON dictionary.                                                                                                                                              |
| [`to_json`](#fiftyone.core.odm.OntologyDocument.to_json)([pretty_print])                              | Serializes the document to a JSON string.                                                                                                                                                        |
| [`to_mongo`](#fiftyone.core.odm.OntologyDocument.to_mongo)(\*args, \*\*kwargs)                        | Return as SON data ready for use with MongoDB.                                                                                                                                                   |
| [`update`](#fiftyone.core.odm.OntologyDocument.update)(\*\*kwargs)                                    | Performs an update on the `Document` A convenience wrapper to `update()`.                                                                                                                        |
| [`validate`](#fiftyone.core.odm.OntologyDocument.validate)([clean])                                   | Ensure that all fields' values are valid and that required fields are present.                                                                                                                   |

**Miscellaneous:**

| [`DoesNotExist`](#fiftyone.core.odm.OntologyDocument.DoesNotExist)                       |    |
|------------------------------------------------------------------------------------------|----|
| [`MultipleObjectsReturned`](#fiftyone.core.odm.OntologyDocument.MultipleObjectsReturned) |    |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.OntologyDocument.my_metaclass)   |    |
|----------------------------------------------------------------------|----|

#### name

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### slug

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### version

A 32 bit integer field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### schema_version

A 32 bit integer field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### type

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### description

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### root

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### created_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### last_modified_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### save(\*args: Any, \*\*kwargs: Any) → [OntologyDocument](fiftyone.core.odm.ontology.md#fiftyone.core.odm.ontology.OntologyDocument)

Saves the document to the database.

If the document already exists, it will be updated, otherwise it will
be created.

* **Parameters:**
  * **upsert** (*False*) – whether to insert the document if it has an `id`
    populated but no document with that ID exists in the database
  * **validate** (*True*) – whether to validate the document
  * **safe** (*False*) – whether to `reload()` the document before raising
    any errors
* **Returns:**
  self

#### *exception* DoesNotExist

Bases: `DoesNotExist`

**Methods:**

| [`add_note`](#fiftyone.core.odm.OntologyDocument.DoesNotExist.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.OntologyDocument.DoesNotExist.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.OntologyDocument.DoesNotExist.args)   |    |
|-------------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

#### *exception* MultipleObjectsReturned

Bases: `MultipleObjectsReturned`

**Methods:**

| [`add_note`](#fiftyone.core.odm.OntologyDocument.MultipleObjectsReturned.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.OntologyDocument.MultipleObjectsReturned.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.OntologyDocument.MultipleObjectsReturned.args)   |    |
|------------------------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

#### STRICT *= False*

#### cascade_save(\*\*kwargs)

Recursively save any references and generic references on the
document.

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### *classmethod* compare_indexes()

Compares the indexes defined in MongoEngine with the ones
existing in the database. Returns any missing/extra indexes.

#### copy(new_id=False)

Returns a deep copy of the document.

* **Parameters:**
  **new_id** (*False*) – whether to generate a new ID for the copied
  document. By default, the ID is left as `None` and will be
  automatically populated when the document is added to the
  database

#### copy_with_new_id()

#### *classmethod* create_index(keys, background=False, \*\*kwargs)

Creates the given indexes if required.

* **Parameters:**
  * **keys** – a single index key or a list of index keys (to
    construct a multi-field index); keys may be prefixed with a **+**
    or a **-** to determine the index ordering
  * **background** – Allows index creation in the background

#### delete(signal_kwargs=None, \*\*write_concern)

Delete the `Document` from the database. This
will only take effect if the document has been previously saved.

* **Parameters:**
  * **signal_kwargs** – (optional) kwargs dictionary to be passed to
    the signal calls.
  * **write_concern** – Extra keyword arguments are passed down which
    will be used as options for the resultant `getLastError` command.
    For example, `save(..., w: 2, fsync: True)` will
    wait until at least two servers have recorded the write and
    will force an fsync on the primary server.

#### *classmethod* drop_collection()

Drops the entire collection associated with this
`Document` type from the database.

Raises `OperationError` if the document has no collection set
(i.g. if it is `abstract`)

#### *classmethod* ensure_indexes()

Checks the document meta data and ensures all the indexes exist.

Global defaults can be set in the meta - see guide/defining-documents

By default, this will get called automatically upon first interaction with the
Document collection (query, save, etc) so unless you disabled `auto_create_index`, you
shouldn’t have to call this manually.

This also gets called upon every call to Document.save if `auto_create_index_on_save` is set to True

If called multiple times, MongoDB will not re-recreate indexes if they exist already

#### NOTE
You can disable automatic index creation by setting
`auto_create_index` to False in the documents meta data

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

A field wrapper around MongoDB’s ObjectIds.

#### *property* in_db

Whether the document has been inserted into the database.

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### *classmethod* list_indexes()

Lists all indexes that should be created for the Document collection.
It includes all the indexes from super- and sub-classes.

Note that it will only return the indexes’ fields, not the indexes’ options

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### modify(query=None, \*\*update)

Perform an atomic update of the document in the database and reload
the document object using updated version.

Returns True if the document has been updated or False if the document
in the database doesn’t match the query.

#### NOTE
All unsaved changes that have been made to the document are
rejected if the method returns True.

* **Parameters:**
  * **query** – the update will be performed only if the document in the
    database matches the query
  * **update** – Django-style update keyword arguments

#### my_metaclass

alias of `TopLevelDocumentMetaclass`

#### *property* pk

Get the primary key.

#### *classmethod* register_delete_rule(document_cls, field_name, rule)

This method registers the delete rules to apply when removing this
object.

#### reload(\*fields, \*\*kwargs)

Reloads the document from the database.

* **Parameters:**
  **\*fields** – an optional args list of specific fields to reload

#### select_related(max_depth=1)

Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to
a maximum depth in order to cut down the number queries to mongodb.

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### switch_collection(collection_name, keep_created=True)

Temporarily switch the collection for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_collection('old-users')
user.save()
```

* **Parameters:**
  * **collection_name** (*str*) – The database alias to use for saving the
    document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching collection, else is reset to True

#### SEE ALSO
Use `switch_db`
if you need to read from another database

#### switch_db(db_alias, keep_created=True)

Temporarily switch the database for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_db('archive-db')
user.save()
```

* **Parameters:**
  * **db_alias** (*str*) – The database alias to use for saving the document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching db, else is reset to True

#### SEE ALSO
Use `switch_collection`
if you need to read from another collection

#### to_dbref()

Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in
`__raw__` queries.

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### update(\*\*kwargs)

Performs an update on the `Document`
A convenience wrapper to `update()`.

Raises `OperationError` if called on an object that has not yet
been saved.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.OntologyType(\*values)

Bases: `str`, `Enum`

Allowed values for [`OntologyDocument.type`](#fiftyone.core.odm.OntologyDocument.type) in storage and APIs.

`TAXONOMY` — a reusable hierarchical class tree. Multiple annotation
ontologies can reference the same taxonomy by name.

`ANNOTATION_ONTOLOGY` — a container that defines classes, attributes
(with optional conditional display logic), and an optional reference to
a bundled taxonomy. This is the document that gets connected to a
label schema on a field.

**Attributes:**

| [`TAXONOMY`](#fiftyone.core.odm.OntologyType.TAXONOMY)                       |    |
|------------------------------------------------------------------------------|----|
| [`ANNOTATION_ONTOLOGY`](#fiftyone.core.odm.OntologyType.ANNOTATION_ONTOLOGY) |    |

**Methods:**

| [`encode`](#fiftyone.core.odm.OntologyType.encode)([encoding, errors])     | Encode the string using the codec registered for encoding.                                                  |
|----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
| [`replace`](#fiftyone.core.odm.OntologyType.replace)(old, new, /[, count]) | Return a copy with all occurrences of substring old replaced by new.                                        |
| [`split`](#fiftyone.core.odm.OntologyType.split)([sep, maxsplit])          | Return a list of the substrings in the string, using sep as the separator string.                           |
| [`rsplit`](#fiftyone.core.odm.OntologyType.rsplit)([sep, maxsplit])        | Return a list of the substrings in the string, using sep as the separator string.                           |
| [`join`](#fiftyone.core.odm.OntologyType.join)(iterable, /)                | Concatenate any number of strings.                                                                          |
| [`capitalize`](#fiftyone.core.odm.OntologyType.capitalize)()               | Return a capitalized version of the string.                                                                 |
| [`casefold`](#fiftyone.core.odm.OntologyType.casefold)()                   | Return a version of the string suitable for caseless comparisons.                                           |
| [`title`](#fiftyone.core.odm.OntologyType.title)()                         | Return a version of the string where each word is titlecased.                                               |
| [`center`](#fiftyone.core.odm.OntologyType.center)(width[, fillchar])      | Return a centered string of length width.                                                                   |
| [`count`](#fiftyone.core.odm.OntologyType.count)                           | Return the number of non-overlapping occurrences of substring sub in string S[start:end].                   |
| [`expandtabs`](#fiftyone.core.odm.OntologyType.expandtabs)([tabsize])      | Return a copy where all tab characters are expanded using spaces.                                           |
| [`find`](#fiftyone.core.odm.OntologyType.find)                             | Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].  |
| [`partition`](#fiftyone.core.odm.OntologyType.partition)(sep, /)           | Partition the string into three parts using the given separator.                                            |
| [`index`](#fiftyone.core.odm.OntologyType.index)                           | Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].  |
| [`ljust`](#fiftyone.core.odm.OntologyType.ljust)(width[, fillchar])        | Return a left-justified string of length width.                                                             |
| [`lower`](#fiftyone.core.odm.OntologyType.lower)()                         | Return a copy of the string converted to lowercase.                                                         |
| [`lstrip`](#fiftyone.core.odm.OntologyType.lstrip)([chars])                | Return a copy of the string with leading whitespace removed.                                                |
| [`rfind`](#fiftyone.core.odm.OntologyType.rfind)                           | Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. |
| [`rindex`](#fiftyone.core.odm.OntologyType.rindex)                         | Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. |
| [`rjust`](#fiftyone.core.odm.OntologyType.rjust)(width[, fillchar])        | Return a right-justified string of length width.                                                            |
| [`rstrip`](#fiftyone.core.odm.OntologyType.rstrip)([chars])                | Return a copy of the string with trailing whitespace removed.                                               |
| [`rpartition`](#fiftyone.core.odm.OntologyType.rpartition)(sep, /)         | Partition the string into three parts using the given separator.                                            |
| [`splitlines`](#fiftyone.core.odm.OntologyType.splitlines)([keepends])     | Return a list of the lines in the string, breaking at line boundaries.                                      |
| [`strip`](#fiftyone.core.odm.OntologyType.strip)([chars])                  | Return a copy of the string with leading and trailing whitespace removed.                                   |
| [`swapcase`](#fiftyone.core.odm.OntologyType.swapcase)()                   | Convert uppercase characters to lowercase and lowercase characters to uppercase.                            |
| [`translate`](#fiftyone.core.odm.OntologyType.translate)(table, /)         | Replace each character in the string using the given translation table.                                     |
| [`upper`](#fiftyone.core.odm.OntologyType.upper)()                         | Return a copy of the string converted to uppercase.                                                         |
| [`startswith`](#fiftyone.core.odm.OntologyType.startswith)                 | Return True if the string starts with the specified prefix, False otherwise.                                |
| [`endswith`](#fiftyone.core.odm.OntologyType.endswith)                     | Return True if the string ends with the specified suffix, False otherwise.                                  |
| [`removeprefix`](#fiftyone.core.odm.OntologyType.removeprefix)(prefix, /)  | Return a str with the given prefix string removed if present.                                               |
| [`removesuffix`](#fiftyone.core.odm.OntologyType.removesuffix)(suffix, /)  | Return a str with the given suffix string removed if present.                                               |
| [`isascii`](#fiftyone.core.odm.OntologyType.isascii)()                     | Return True if all characters in the string are ASCII, False otherwise.                                     |
| [`islower`](#fiftyone.core.odm.OntologyType.islower)()                     | Return True if the string is a lowercase string, False otherwise.                                           |
| [`isupper`](#fiftyone.core.odm.OntologyType.isupper)()                     | Return True if the string is an uppercase string, False otherwise.                                          |
| [`istitle`](#fiftyone.core.odm.OntologyType.istitle)()                     | Return True if the string is a title-cased string, False otherwise.                                         |
| [`isspace`](#fiftyone.core.odm.OntologyType.isspace)()                     | Return True if the string is a whitespace string, False otherwise.                                          |
| [`isdecimal`](#fiftyone.core.odm.OntologyType.isdecimal)()                 | Return True if the string is a decimal string, False otherwise.                                             |
| [`isdigit`](#fiftyone.core.odm.OntologyType.isdigit)()                     | Return True if the string is a digit string, False otherwise.                                               |
| [`isnumeric`](#fiftyone.core.odm.OntologyType.isnumeric)()                 | Return True if the string is a numeric string, False otherwise.                                             |
| [`isalpha`](#fiftyone.core.odm.OntologyType.isalpha)()                     | Return True if the string is an alphabetic string, False otherwise.                                         |
| [`isalnum`](#fiftyone.core.odm.OntologyType.isalnum)()                     | Return True if the string is an alpha-numeric string, False otherwise.                                      |
| [`isidentifier`](#fiftyone.core.odm.OntologyType.isidentifier)()           | Return True if the string is a valid Python identifier, False otherwise.                                    |
| [`isprintable`](#fiftyone.core.odm.OntologyType.isprintable)()             | Return True if all characters in the string are printable, False otherwise.                                 |
| [`zfill`](#fiftyone.core.odm.OntologyType.zfill)(width, /)                 | Pad a numeric string with zeros on the left, to fill a field of the given width.                            |
| [`format`](#fiftyone.core.odm.OntologyType.format)(\*args, \*\*kwargs)     | Return a formatted version of the string, using substitutions from args and kwargs.                         |
| [`format_map`](#fiftyone.core.odm.OntologyType.format_map)(mapping, /)     | Return a formatted version of the string, using substitutions from mapping.                                 |
| [`maketrans`](#fiftyone.core.odm.OntologyType.maketrans)                   | Return a translation table usable for str.translate().                                                      |

#### TAXONOMY *= 'taxonomy'*

#### ANNOTATION_ONTOLOGY *= 'annotation_ontology'*

#### encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding
: The encoding in which to encode the string.

errors
: The error handling scheme to use for encoding errors.
  The default is ‘strict’ meaning that encoding errors raise a
  UnicodeEncodeError.  Other possible values are ‘ignore’, ‘replace’
  and ‘xmlcharrefreplace’ as well as any other name registered with
  codecs.register_error that can handle UnicodeEncodeErrors.

#### replace(old, new, , count=-1)

Return a copy with all occurrences of substring old replaced by new.

> count
> : Maximum number of occurrences to replace.
>   -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are
replaced.

#### split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

> sep
> : The separator used to split the string.
>   <br/>
>   When set to None (the default value), will split on any
>   whitespace character (including n r t f and spaces) and
>   will discard empty strings from the result.

> maxsplit
> : Maximum number of splits.
>   -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been
intentionally delimited.  With natural text that includes
punctuation, consider using the regular expression module.

#### rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

> sep
> : The separator used to split the string.
>   <br/>
>   When set to None (the default value), will split on any
>   whitespace character (including n r t f and spaces) and
>   will discard empty strings from the result.

> maxsplit
> : Maximum number of splits.
>   -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

#### join(iterable,)

Concatenate any number of strings.

The string whose method is called is inserted in between each given
string.  The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

#### capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the
rest lower case.

#### casefold()

Return a version of the string suitable for caseless comparisons.

#### title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all
remaining cased characters have lower case.

#### center(width, fillchar=' ',)

Return a centered string of length width.

Padding is done using the specified fill character (default is
a space).

#### count()

Return the number of non-overlapping occurrences of substring sub in string S[start:end].

Optional arguments start and end are interpreted as in slice
notation.

#### expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

#### find()

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].

Optional arguments start and end are interpreted as in slice
notation.  Return -1 on failure.

#### partition(sep,)

Partition the string into three parts using the given separator.

This will search for the separator in the string.  If the separator
is found, returns a 3-tuple containing the part before the
separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing
the original string and two empty strings.

#### index()

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].

Optional arguments start and end are interpreted as in slice
notation.  Raises ValueError when the substring is not found.

#### ljust(width, fillchar=' ',)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is
a space).

#### lower()

Return a copy of the string converted to lowercase.

#### lstrip(chars=None,)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

#### rfind()

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].

Optional arguments start and end are interpreted as in slice
notation.  Return -1 on failure.

#### rindex()

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].

Optional arguments start and end are interpreted as in slice
notation.  Raises ValueError when the substring is not found.

#### rjust(width, fillchar=' ',)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is
a space).

#### rstrip(chars=None,)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

#### rpartition(sep,)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the
end.  If the separator is found, returns a 3-tuple containing the
part before the separator, the separator itself, and the part after
it.

If the separator is not found, returns a 3-tuple containing two
empty strings and the original string.

#### splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends
is given and true.

#### strip(chars=None,)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

#### swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

#### translate(table,)

Replace each character in the string using the given translation table.

> table
> : Translation table, which must be a mapping of Unicode ordinals
>   to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via \_\_getitem_\_, for
instance a dictionary or list.  If this operation raises
LookupError, the character is left untouched.  Characters mapped to
None are deleted.

#### upper()

Return a copy of the string converted to uppercase.

#### startswith()

Return True if the string starts with the specified prefix, False otherwise.

prefix
: A string or a tuple of strings to try.

start
: Optional start position. Default: start of the string.

end
: Optional stop position. Default: end of the string.

#### endswith()

Return True if the string ends with the specified suffix, False otherwise.

suffix
: A string or a tuple of strings to try.

start
: Optional start position. Default: start of the string.

end
: Optional stop position. Default: end of the string.

#### removeprefix(prefix,)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return
string[len(prefix):].  Otherwise, return a copy of the original
string.

#### removesuffix(suffix,)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not
empty, return string[:-len(suffix)].  Otherwise, return a copy of
the original string.

#### isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F.
Empty string is ASCII too.

#### islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are
lowercase and there is at least one cased character in the string.

#### isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are
uppercase and there is at least one cased character in the string.

#### istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only
follow uncased characters and lowercase characters only cased ones.

#### isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are
whitespace and there is at least one character in the string.

#### isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are
decimal and there is at least one character in the string.

#### isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are
digits and there is at least one character in the string.

#### isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and
there is at least one character in the string.

#### isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are
alphabetic and there is at least one character in the string.

#### isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are
alpha-numeric and there is at least one character in the string.

#### isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved
identifier, such as “def” or “class”.

#### isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

#### zfill(width,)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

#### format(\*args, \*\*kwargs)

Return a formatted version of the string, using substitutions from args and kwargs.
The substitutions are identified by braces (‘{’ and ‘}’).

#### format_map(mapping,)

Return a formatted version of the string, using substitutions from mapping.
The substitutions are identified by braces (‘{’ and ‘}’).

#### *static* maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping
Unicode ordinals (integers) or characters to Unicode ordinals,
strings or None.  Character keys will be then converted to ordinals.
If there are two arguments, they must be strings of equal length,
and in the resulting dictionary, each character in x will be mapped
to the character at the same position in y.  If there is a third
argument, it must be a string, whose characters will be mapped to
None in the result.

### *class* fiftyone.core.odm.RunDocument(\*\*kwargs)

Bases: [`Document`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document)

Backing document for dataset runs.

**Attributes:**

| [`dataset_id`](#fiftyone.core.odm.RunDocument.dataset_id)     | An Object ID field.                                                                                                                                          |
|---------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`key`](#fiftyone.core.odm.RunDocument.key)                   | A unicode string field.                                                                                                                                      |
| [`version`](#fiftyone.core.odm.RunDocument.version)           | A unicode string field.                                                                                                                                      |
| [`timestamp`](#fiftyone.core.odm.RunDocument.timestamp)       | A datetime field.                                                                                                                                            |
| [`config`](#fiftyone.core.odm.RunDocument.config)             | A dictionary field that wraps a standard Python dictionary.                                                                                                  |
| [`view_stages`](#fiftyone.core.odm.RunDocument.view_stages)   | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.                                 |
| [`results`](#fiftyone.core.odm.RunDocument.results)           | A GridFS storage field.                                                                                                                                      |
| [`results_meta`](#fiftyone.core.odm.RunDocument.results_meta) | Facts that describe `results` — a count, a path — written when the results are saved so a reader can answer for them without pulling the blob out of GridFS. |
| [`STRICT`](#fiftyone.core.odm.RunDocument.STRICT)             |                                                                                                                                                              |
| [`field_names`](#fiftyone.core.odm.RunDocument.field_names)   | An ordered tuple of the public fields of this document.                                                                                                      |
| [`id`](#fiftyone.core.odm.RunDocument.id)                     | A field wrapper around MongoDB's ObjectIds.                                                                                                                  |
| [`in_db`](#fiftyone.core.odm.RunDocument.in_db)               | Whether the document has been inserted into the database.                                                                                                    |
| [`pk`](#fiftyone.core.odm.RunDocument.pk)                     | Get the primary key.                                                                                                                                         |

**Miscellaneous:**

| [`DoesNotExist`](#fiftyone.core.odm.RunDocument.DoesNotExist)                       |    |
|-------------------------------------------------------------------------------------|----|
| [`MultipleObjectsReturned`](#fiftyone.core.odm.RunDocument.MultipleObjectsReturned) |    |

**Methods:**

| [`cascade_save`](#fiftyone.core.odm.RunDocument.cascade_save)(\*\*kwargs)                        | Recursively save any references and generic references on the document.                                                                                                                          |
|--------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`clean`](#fiftyone.core.odm.RunDocument.clean)()                                                | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                                                                         |
| [`clear_field`](#fiftyone.core.odm.RunDocument.clear_field)(field_name)                          | Clears the field from the document.                                                                                                                                                              |
| [`compare_indexes`](#fiftyone.core.odm.RunDocument.compare_indexes)()                            | Compares the indexes defined in MongoEngine with the ones existing in the database.                                                                                                              |
| [`copy`](#fiftyone.core.odm.RunDocument.copy)([new_id])                                          | Returns a deep copy of the document.                                                                                                                                                             |
| [`copy_with_new_id`](#fiftyone.core.odm.RunDocument.copy_with_new_id)()                          |                                                                                                                                                                                                  |
| [`create_index`](#fiftyone.core.odm.RunDocument.create_index)(keys[, background])                | Creates the given indexes if required.                                                                                                                                                           |
| [`delete`](#fiftyone.core.odm.RunDocument.delete)([signal_kwargs])                               | Delete the `Document` from the database.                                                                                                                                                         |
| [`drop_collection`](#fiftyone.core.odm.RunDocument.drop_collection)()                            | Drops the entire collection associated with this `Document` type from the database.                                                                                                              |
| [`ensure_indexes`](#fiftyone.core.odm.RunDocument.ensure_indexes)()                              | Checks the document meta data and ensures all the indexes exist.                                                                                                                                 |
| [`fancy_repr`](#fiftyone.core.odm.RunDocument.fancy_repr)([class_name, select_fields, ...])      | Generates a customizable string representation of the document.                                                                                                                                  |
| [`field_to_mongo`](#fiftyone.core.odm.RunDocument.field_to_mongo)(field_name)                    |                                                                                                                                                                                                  |
| [`field_to_python`](#fiftyone.core.odm.RunDocument.field_to_python)(field_name, value)           |                                                                                                                                                                                                  |
| [`from_dict`](#fiftyone.core.odm.RunDocument.from_dict)(d[, extended])                           | Loads the document from a BSON/JSON dictionary.                                                                                                                                                  |
| [`from_json`](#fiftyone.core.odm.RunDocument.from_json)(s)                                       | Loads the document from a JSON string.                                                                                                                                                           |
| [`get_field`](#fiftyone.core.odm.RunDocument.get_field)(field_name)                              | Gets the field of the document.                                                                                                                                                                  |
| [`get_text_score`](#fiftyone.core.odm.RunDocument.get_text_score)()                              | Get text score from text query                                                                                                                                                                   |
| [`has_field`](#fiftyone.core.odm.RunDocument.has_field)(field_name)                              | Determines whether the document has a field of the given name.                                                                                                                                   |
| [`iter_fields`](#fiftyone.core.odm.RunDocument.iter_fields)()                                    | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                                                                         |
| [`list_indexes`](#fiftyone.core.odm.RunDocument.list_indexes)()                                  | Lists all indexes that should be created for the Document collection.                                                                                                                            |
| [`merge`](#fiftyone.core.odm.RunDocument.merge)(doc[, merge_lists, merge_dicts, overwrite])      | Merges the contents of the given document into this document.                                                                                                                                    |
| [`modify`](#fiftyone.core.odm.RunDocument.modify)([query])                                       | Perform an atomic update of the document in the database and reload the document object using updated version.                                                                                   |
| [`register_delete_rule`](#fiftyone.core.odm.RunDocument.register_delete_rule)(document_cls, ...) | This method registers the delete rules to apply when removing this object.                                                                                                                       |
| [`reload`](#fiftyone.core.odm.RunDocument.reload)(\*fields, \*\*kwargs)                          | Reloads the document from the database.                                                                                                                                                          |
| [`save`](#fiftyone.core.odm.RunDocument.save)([upsert, validate, safe])                          | Saves the document to the database.                                                                                                                                                              |
| [`select_related`](#fiftyone.core.odm.RunDocument.select_related)([max_depth])                   | Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to a maximum depth in order to cut down the number queries to mongodb. |
| [`set_field`](#fiftyone.core.odm.RunDocument.set_field)(field_name, value[, create])             | Sets the value of a field of the document.                                                                                                                                                       |
| [`switch_collection`](#fiftyone.core.odm.RunDocument.switch_collection)(collection_name[, ...])  | Temporarily switch the collection for a document instance.                                                                                                                                       |
| [`switch_db`](#fiftyone.core.odm.RunDocument.switch_db)(db_alias[, keep_created])                | Temporarily switch the database for a document instance.                                                                                                                                         |
| [`to_dbref`](#fiftyone.core.odm.RunDocument.to_dbref)()                                          | Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in `__raw__` queries.                                                     |
| [`to_dict`](#fiftyone.core.odm.RunDocument.to_dict)([extended])                                  | Serializes this document to a BSON/JSON dictionary.                                                                                                                                              |
| [`to_json`](#fiftyone.core.odm.RunDocument.to_json)([pretty_print])                              | Serializes the document to a JSON string.                                                                                                                                                        |
| [`to_mongo`](#fiftyone.core.odm.RunDocument.to_mongo)(\*args, \*\*kwargs)                        | Return as SON data ready for use with MongoDB.                                                                                                                                                   |
| [`update`](#fiftyone.core.odm.RunDocument.update)(\*\*kwargs)                                    | Performs an update on the `Document` A convenience wrapper to `update()`.                                                                                                                        |
| [`validate`](#fiftyone.core.odm.RunDocument.validate)([clean])                                   | Ensure that all fields' values are valid and that required fields are present.                                                                                                                   |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.RunDocument.my_metaclass)   |    |
|-----------------------------------------------------------------|----|

#### dataset_id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### key

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### version

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### timestamp

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### config

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### view_stages

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### results

A GridFS storage field.

#### results_meta

Facts that describe `results` — a count, a path — written when the
results are saved so a reader can answer for them without pulling the
blob out of GridFS.

#### *exception* DoesNotExist

Bases: `DoesNotExist`

**Methods:**

| [`add_note`](#fiftyone.core.odm.RunDocument.DoesNotExist.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|-------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.RunDocument.DoesNotExist.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.RunDocument.DoesNotExist.args)   |    |
|--------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

#### *exception* MultipleObjectsReturned

Bases: `MultipleObjectsReturned`

**Methods:**

| [`add_note`](#fiftyone.core.odm.RunDocument.MultipleObjectsReturned.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.RunDocument.MultipleObjectsReturned.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.RunDocument.MultipleObjectsReturned.args)   |    |
|-------------------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

#### STRICT *= False*

#### cascade_save(\*\*kwargs)

Recursively save any references and generic references on the
document.

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### *classmethod* compare_indexes()

Compares the indexes defined in MongoEngine with the ones
existing in the database. Returns any missing/extra indexes.

#### copy(new_id=False)

Returns a deep copy of the document.

* **Parameters:**
  **new_id** (*False*) – whether to generate a new ID for the copied
  document. By default, the ID is left as `None` and will be
  automatically populated when the document is added to the
  database

#### copy_with_new_id()

#### *classmethod* create_index(keys, background=False, \*\*kwargs)

Creates the given indexes if required.

* **Parameters:**
  * **keys** – a single index key or a list of index keys (to
    construct a multi-field index); keys may be prefixed with a **+**
    or a **-** to determine the index ordering
  * **background** – Allows index creation in the background

#### delete(signal_kwargs=None, \*\*write_concern)

Delete the `Document` from the database. This
will only take effect if the document has been previously saved.

* **Parameters:**
  * **signal_kwargs** – (optional) kwargs dictionary to be passed to
    the signal calls.
  * **write_concern** – Extra keyword arguments are passed down which
    will be used as options for the resultant `getLastError` command.
    For example, `save(..., w: 2, fsync: True)` will
    wait until at least two servers have recorded the write and
    will force an fsync on the primary server.

#### *classmethod* drop_collection()

Drops the entire collection associated with this
`Document` type from the database.

Raises `OperationError` if the document has no collection set
(i.g. if it is `abstract`)

#### *classmethod* ensure_indexes()

Checks the document meta data and ensures all the indexes exist.

Global defaults can be set in the meta - see guide/defining-documents

By default, this will get called automatically upon first interaction with the
Document collection (query, save, etc) so unless you disabled `auto_create_index`, you
shouldn’t have to call this manually.

This also gets called upon every call to Document.save if `auto_create_index_on_save` is set to True

If called multiple times, MongoDB will not re-recreate indexes if they exist already

#### NOTE
You can disable automatic index creation by setting
`auto_create_index` to False in the documents meta data

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

A field wrapper around MongoDB’s ObjectIds.

#### *property* in_db

Whether the document has been inserted into the database.

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### *classmethod* list_indexes()

Lists all indexes that should be created for the Document collection.
It includes all the indexes from super- and sub-classes.

Note that it will only return the indexes’ fields, not the indexes’ options

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### modify(query=None, \*\*update)

Perform an atomic update of the document in the database and reload
the document object using updated version.

Returns True if the document has been updated or False if the document
in the database doesn’t match the query.

#### NOTE
All unsaved changes that have been made to the document are
rejected if the method returns True.

* **Parameters:**
  * **query** – the update will be performed only if the document in the
    database matches the query
  * **update** – Django-style update keyword arguments

#### my_metaclass

alias of `TopLevelDocumentMetaclass`

#### *property* pk

Get the primary key.

#### *classmethod* register_delete_rule(document_cls, field_name, rule)

This method registers the delete rules to apply when removing this
object.

#### reload(\*fields, \*\*kwargs)

Reloads the document from the database.

* **Parameters:**
  **\*fields** – an optional args list of specific fields to reload

#### save(upsert=False, validate=True, safe=False, \*\*kwargs)

Saves the document to the database.

If the document already exists, it will be updated, otherwise it will
be created.

* **Parameters:**
  * **upsert** (*False*) – whether to insert the document if it has an `id`
    populated but no document with that ID exists in the database
  * **validate** (*True*) – whether to validate the document
  * **safe** (*False*) – whether to `reload()` the document before raising
    any errors
* **Returns:**
  self

#### select_related(max_depth=1)

Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to
a maximum depth in order to cut down the number queries to mongodb.

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### switch_collection(collection_name, keep_created=True)

Temporarily switch the collection for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_collection('old-users')
user.save()
```

* **Parameters:**
  * **collection_name** (*str*) – The database alias to use for saving the
    document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching collection, else is reset to True

#### SEE ALSO
Use `switch_db`
if you need to read from another database

#### switch_db(db_alias, keep_created=True)

Temporarily switch the database for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_db('archive-db')
user.save()
```

* **Parameters:**
  * **db_alias** (*str*) – The database alias to use for saving the document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching db, else is reset to True

#### SEE ALSO
Use `switch_collection`
if you need to read from another collection

#### to_dbref()

Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in
`__raw__` queries.

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### update(\*\*kwargs)

Performs an update on the `Document`
A convenience wrapper to `update()`.

Raises `OperationError` if called on an object that has not yet
been saved.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.DatasetSampleDocument(\*\*kwargs)

Bases: [`DatasetMixin`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.DatasetMixin), [`Document`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document)

Base class for sample documents backing samples in datasets.

All `fiftyone.core.dataset.Dataset._sample_doc_cls` classes inherit from
this class.

**Attributes:**

| [`id`](#fiftyone.core.odm.DatasetSampleDocument.id)                             | An Object ID field.                                                                                                                          |
|---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| [`filepath`](#fiftyone.core.odm.DatasetSampleDocument.filepath)                 | A unicode string field.                                                                                                                      |
| [`media_reference`](#fiftyone.core.odm.DatasetSampleDocument.media_reference)   | which media source its media comes from, and where in that source it is.                                                                     |
| [`tags`](#fiftyone.core.odm.DatasetSampleDocument.tags)                         | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.                 |
| [`metadata`](#fiftyone.core.odm.DatasetSampleDocument.metadata)                 | A field that stores instances of a given type of [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object. |
| [`created_at`](#fiftyone.core.odm.DatasetSampleDocument.created_at)             | A datetime field.                                                                                                                            |
| [`last_modified_at`](#fiftyone.core.odm.DatasetSampleDocument.last_modified_at) | A datetime field.                                                                                                                            |
| [`media_type`](#fiftyone.core.odm.DatasetSampleDocument.media_type)             |                                                                                                                                              |
| [`STRICT`](#fiftyone.core.odm.DatasetSampleDocument.STRICT)                     |                                                                                                                                              |
| [`collection_name`](#fiftyone.core.odm.DatasetSampleDocument.collection_name)   |                                                                                                                                              |
| [`field_names`](#fiftyone.core.odm.DatasetSampleDocument.field_names)           | An ordered tuple of the public fields of this document.                                                                                      |
| [`in_db`](#fiftyone.core.odm.DatasetSampleDocument.in_db)                       | Whether the document has been inserted into the database.                                                                                    |
| [`pk`](#fiftyone.core.odm.DatasetSampleDocument.pk)                             | Get the primary key.                                                                                                                         |

**Methods:**

| [`clean`](#fiftyone.core.odm.DatasetSampleDocument.clean)()                                                       | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                                                                         |
|-------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`add_field`](#fiftyone.core.odm.DatasetSampleDocument.add_field)(path, ftype[, embedded_doc_type, ...])          | Adds a new field or embedded field to the document, if necessary.                                                                                                                                |
| [`add_implied_field`](#fiftyone.core.odm.DatasetSampleDocument.add_implied_field)(path, value[, ...])             | Adds the field or embedded field to the document, if necessary, inferring the field type from the provided value.                                                                                |
| [`cascade_save`](#fiftyone.core.odm.DatasetSampleDocument.cascade_save)(\*\*kwargs)                               | Recursively save any references and generic references on the document.                                                                                                                          |
| [`clear_field`](#fiftyone.core.odm.DatasetSampleDocument.clear_field)(field_name)                                 | Clears the field from the document.                                                                                                                                                              |
| [`compare_indexes`](#fiftyone.core.odm.DatasetSampleDocument.compare_indexes)()                                   | Compares the indexes defined in MongoEngine with the ones existing in the database.                                                                                                              |
| [`copy`](#fiftyone.core.odm.DatasetSampleDocument.copy)([new_id])                                                 | Returns a deep copy of the document.                                                                                                                                                             |
| [`copy_with_new_id`](#fiftyone.core.odm.DatasetSampleDocument.copy_with_new_id)()                                 |                                                                                                                                                                                                  |
| [`create_index`](#fiftyone.core.odm.DatasetSampleDocument.create_index)(keys[, background])                       | Creates the given indexes if required.                                                                                                                                                           |
| [`delete`](#fiftyone.core.odm.DatasetSampleDocument.delete)([signal_kwargs])                                      | Delete the `Document` from the database.                                                                                                                                                         |
| [`drop_collection`](#fiftyone.core.odm.DatasetSampleDocument.drop_collection)()                                   | Drops the entire collection associated with this `Document` type from the database.                                                                                                              |
| [`ensure_indexes`](#fiftyone.core.odm.DatasetSampleDocument.ensure_indexes)()                                     | Checks the document meta data and ensures all the indexes exist.                                                                                                                                 |
| [`fancy_repr`](#fiftyone.core.odm.DatasetSampleDocument.fancy_repr)([class_name, select_fields, ...])             | Generates a customizable string representation of the document.                                                                                                                                  |
| [`field_to_mongo`](#fiftyone.core.odm.DatasetSampleDocument.field_to_mongo)(field_name)                           |                                                                                                                                                                                                  |
| [`field_to_python`](#fiftyone.core.odm.DatasetSampleDocument.field_to_python)(field_name, value)                  |                                                                                                                                                                                                  |
| [`from_dict`](#fiftyone.core.odm.DatasetSampleDocument.from_dict)(d[, extended])                                  | Loads the document from a BSON/JSON dictionary.                                                                                                                                                  |
| [`from_json`](#fiftyone.core.odm.DatasetSampleDocument.from_json)(s)                                              | Loads the document from a JSON string.                                                                                                                                                           |
| [`get_field`](#fiftyone.core.odm.DatasetSampleDocument.get_field)(field_name)                                     | Gets the field of the document.                                                                                                                                                                  |
| [`get_field_schema`](#fiftyone.core.odm.DatasetSampleDocument.get_field_schema)([ftype, embedded_doc_type, ...])  | Returns a schema dictionary describing the fields of this document.                                                                                                                              |
| [`get_text_score`](#fiftyone.core.odm.DatasetSampleDocument.get_text_score)()                                     | Get text score from text query                                                                                                                                                                   |
| [`has_field`](#fiftyone.core.odm.DatasetSampleDocument.has_field)(field_name)                                     | Determines whether the document has a field of the given name.                                                                                                                                   |
| [`iter_fields`](#fiftyone.core.odm.DatasetSampleDocument.iter_fields)()                                           | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                                                                         |
| [`list_indexes`](#fiftyone.core.odm.DatasetSampleDocument.list_indexes)()                                         | Lists all indexes that should be created for the Document collection.                                                                                                                            |
| [`merge`](#fiftyone.core.odm.DatasetSampleDocument.merge)(doc[, merge_lists, merge_dicts, overwrite])             | Merges the contents of the given document into this document.                                                                                                                                    |
| [`merge_field_schema`](#fiftyone.core.odm.DatasetSampleDocument.merge_field_schema)(schema[, expand_schema, ...]) | Merges the field schema into this document.                                                                                                                                                      |
| [`modify`](#fiftyone.core.odm.DatasetSampleDocument.modify)([query])                                              | Perform an atomic update of the document in the database and reload the document object using updated version.                                                                                   |
| [`register_delete_rule`](#fiftyone.core.odm.DatasetSampleDocument.register_delete_rule)(document_cls, ...)        | This method registers the delete rules to apply when removing this object.                                                                                                                       |
| [`reload`](#fiftyone.core.odm.DatasetSampleDocument.reload)(\*fields, \*\*kwargs)                                 | Reloads the document from the database.                                                                                                                                                          |
| [`save`](#fiftyone.core.odm.DatasetSampleDocument.save)([upsert, validate, safe])                                 | Saves the document to the database.                                                                                                                                                              |
| [`select_related`](#fiftyone.core.odm.DatasetSampleDocument.select_related)([max_depth])                          | Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to a maximum depth in order to cut down the number queries to mongodb. |
| [`set_field`](#fiftyone.core.odm.DatasetSampleDocument.set_field)(field_name, value[, create, ...])               | Sets the value of a field of the document.                                                                                                                                                       |
| [`switch_collection`](#fiftyone.core.odm.DatasetSampleDocument.switch_collection)(collection_name[, ...])         | Temporarily switch the collection for a document instance.                                                                                                                                       |
| [`switch_db`](#fiftyone.core.odm.DatasetSampleDocument.switch_db)(db_alias[, keep_created])                       | Temporarily switch the database for a document instance.                                                                                                                                         |
| [`to_dbref`](#fiftyone.core.odm.DatasetSampleDocument.to_dbref)()                                                 | Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in `__raw__` queries.                                                     |
| [`to_dict`](#fiftyone.core.odm.DatasetSampleDocument.to_dict)([extended])                                         | Serializes this document to a BSON/JSON dictionary.                                                                                                                                              |
| [`to_json`](#fiftyone.core.odm.DatasetSampleDocument.to_json)([pretty_print])                                     | Serializes the document to a JSON string.                                                                                                                                                        |
| [`to_mongo`](#fiftyone.core.odm.DatasetSampleDocument.to_mongo)(\*args, \*\*kwargs)                               | Return as SON data ready for use with MongoDB.                                                                                                                                                   |
| [`update`](#fiftyone.core.odm.DatasetSampleDocument.update)(\*\*kwargs)                                           | Performs an update on the `Document` A convenience wrapper to `update()`.                                                                                                                        |
| [`validate`](#fiftyone.core.odm.DatasetSampleDocument.validate)([clean])                                          | Ensure that all fields' values are valid and that required fields are present.                                                                                                                   |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.DatasetSampleDocument.my_metaclass)   |    |
|---------------------------------------------------------------------------|----|

#### id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### filepath

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### media_reference

which media source its
media comes from, and where in that source it is.

The source is recorded once on the owning dataset; this field holds only
what is this sample’s alone.

* **Parameters:**
  * **document_type** (*None*) – the
    [`fiftyone.core.media_reference.MediaReference`](fiftyone.core.media_reference.md#fiftyone.core.media_reference.MediaReference) subclass
    stored in this field
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created
* **Type:**
  A reference-backed sample’s media identity

#### tags

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### metadata

A field that stores instances of a given type of
[`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object.

* **Parameters:**
  * **document_type** – the [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type
    stored in this field
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### created_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### last_modified_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *property* media_type

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### STRICT *= False*

#### *classmethod* add_field(path, ftype, embedded_doc_type=None, subfield=None, fields=None, description=None, info=None, read_only=False, expand_schema=True, recursive=True, validate=True, \*\*kwargs)

Adds a new field or embedded field to the document, if necessary.

* **Parameters:**
  * **path** – the field name or `embedded.field.name`
  * **ftype** – the field type to create. Must be a subclass of
    [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
  * **embedded_doc_type** (*None*) – the
    [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type of the
    field. Only applicable when `ftype` is
    [`fiftyone.core.fields.EmbeddedDocumentField`](fiftyone.core.fields.md#fiftyone.core.fields.EmbeddedDocumentField)
  * **subfield** (*None*) – the [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field) type of
    the contained field. Only applicable when `ftype` is
    [`fiftyone.core.fields.ListField`](fiftyone.core.fields.md#fiftyone.core.fields.ListField) or
    [`fiftyone.core.fields.DictField`](fiftyone.core.fields.md#fiftyone.core.fields.DictField)
  * **fields** (*None*) – a list of [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
    instances defining embedded document attributes. Only
    applicable when `ftype` is
    [`fiftyone.core.fields.EmbeddedDocumentField`](fiftyone.core.fields.md#fiftyone.core.fields.EmbeddedDocumentField)
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field should be read-only
  * **expand_schema** (*True*) – whether to add new fields to the schema
    (True) or simply validate that the field already exists with a
    consistent type (False)
  * **recursive** (*True*) – whether to recursively add embedded document
    fields
  * **validate** (*True*) – whether to validate the field against an existing
    field at the same path
* **Returns:**
  True/False whether one or more fields or embedded fields were added
  to the document or its children
* **Raises:**
  **ValueError** – if a field in the schema is not compliant with an
      existing field of the same name

#### *classmethod* add_implied_field(path, value, expand_schema=True, dynamic=False, recursive=True, validate=True)

Adds the field or embedded field to the document, if necessary,
inferring the field type from the provided value.

* **Parameters:**
  * **path** – the field name or `embedded.field.name`
  * **value** – the field value
  * **expand_schema** (*True*) – whether to add new fields to the schema
    (True) or simply validate that the field already exists with a
    consistent type (False)
  * **dynamic** (*False*) – whether to declare dynamic embedded document
    fields
  * **recursive** (*True*) – whether to recursively add embedded document
    fields
  * **validate** (*True*) – whether to validate the field against an existing
    field at the same path
* **Returns:**
  True/False whether one or more fields or embedded fields were added
  to the document or its children
* **Raises:**
  **ValueError** – if a field in the schema is not compliant with an
      existing field of the same name

#### cascade_save(\*\*kwargs)

Recursively save any references and generic references on the
document.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### *property* collection_name

#### *classmethod* compare_indexes()

Compares the indexes defined in MongoEngine with the ones
existing in the database. Returns any missing/extra indexes.

#### copy(new_id=False)

Returns a deep copy of the document.

* **Parameters:**
  **new_id** (*False*) – whether to generate a new ID for the copied
  document. By default, the ID is left as `None` and will be
  automatically populated when the document is added to the
  database

#### copy_with_new_id()

#### *classmethod* create_index(keys, background=False, \*\*kwargs)

Creates the given indexes if required.

* **Parameters:**
  * **keys** – a single index key or a list of index keys (to
    construct a multi-field index); keys may be prefixed with a **+**
    or a **-** to determine the index ordering
  * **background** – Allows index creation in the background

#### delete(signal_kwargs=None, \*\*write_concern)

Delete the `Document` from the database. This
will only take effect if the document has been previously saved.

* **Parameters:**
  * **signal_kwargs** – (optional) kwargs dictionary to be passed to
    the signal calls.
  * **write_concern** – Extra keyword arguments are passed down which
    will be used as options for the resultant `getLastError` command.
    For example, `save(..., w: 2, fsync: True)` will
    wait until at least two servers have recorded the write and
    will force an fsync on the primary server.

#### *classmethod* drop_collection()

Drops the entire collection associated with this
`Document` type from the database.

Raises `OperationError` if the document has no collection set
(i.g. if it is `abstract`)

#### *classmethod* ensure_indexes()

Checks the document meta data and ensures all the indexes exist.

Global defaults can be set in the meta - see guide/defining-documents

By default, this will get called automatically upon first interaction with the
Document collection (query, save, etc) so unless you disabled `auto_create_index`, you
shouldn’t have to call this manually.

This also gets called upon every call to Document.save if `auto_create_index_on_save` is set to True

If called multiple times, MongoDB will not re-recreate indexes if they exist already

#### NOTE
You can disable automatic index creation by setting
`auto_create_index` to False in the documents meta data

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### *classmethod* get_field_schema(ftype=None, embedded_doc_type=None, subfield=None, read_only=None, info_keys=None, created_after=None, include_private=False, flat=False, unwind=True, mode=None)

Returns a schema dictionary describing the fields of this document.

If the document belongs to a dataset, the schema will apply to all
documents in the collection.

* **Parameters:**
  * **ftype** (*None*) – an optional field type or iterable of field types to
    which to restrict the returned schema. Must be subclass(es) of
    [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
  * **embedded_doc_type** (*None*) – an optional embedded document type or
    iterable of types to which to restrict the returned schema.
    Must be subclass(es) of
    [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument)
  * **subfield** (*None*) – an optional subfield type or iterable of subfield
    types to which to restrict the returned schema. Must be
    subclass(es) of [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
  * **read_only** (*None*) – whether to restrict to (True) or exclude (False)
    read-only fields. By default, all fields are included
  * **info_keys** (*None*) – an optional key or list of keys that must be in
    the field’s `info` dict
  * **created_after** (*None*) – an optional `datetime` specifying a minimum
    creation date
  * **include_private** (*False*) – whether to include fields that start with
    `_` in the returned schema
  * **flat** (*False*) – whether to return a flattened schema where all
    embedded document fields are included as top-level keys
  * **unwind** (*True*) – whether to traverse into list fields. Only
    applicable when `flat=True`
  * **mode** (*None*) – whether to apply the above constraints before and/or
    after flattening the schema. Only applicable when `flat=True`.
    Supported values are `("before", "after", "both")`. The
    default is `"after"`
* **Returns:**
  a dict mapping field names to [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
  instances

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### *property* in_db

Whether the document has been inserted into the database.

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### *classmethod* list_indexes()

Lists all indexes that should be created for the Document collection.
It includes all the indexes from super- and sub-classes.

Note that it will only return the indexes’ fields, not the indexes’ options

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### *classmethod* merge_field_schema(schema, expand_schema=True, recursive=True, validate=True, overwrite=False)

Merges the field schema into this document.

* **Parameters:**
  * **schema** – a dict mapping field names or `embedded.field.names` to
    [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field) instances
  * **expand_schema** (*True*) – whether to add new fields to the schema
    (True) or simply validate that fields already exist with
    consistent types (False)
  * **recursive** (*True*) – whether to recursively merge embedded document
    fields
  * **validate** (*True*) – whether to validate fields against existing fields
    at the same path
  * **overwrite** (*False*) – whether to overwrite the editable metadata of
    existing fields
* **Returns:**
  True/False whether any new fields were added
* **Raises:**
  **ValueError** – if a field in the schema is not compliant with an
      existing field of the same name or a new field is found but
      `expand_schema == False`

#### modify(query=None, \*\*update)

Perform an atomic update of the document in the database and reload
the document object using updated version.

Returns True if the document has been updated or False if the document
in the database doesn’t match the query.

#### NOTE
All unsaved changes that have been made to the document are
rejected if the method returns True.

* **Parameters:**
  * **query** – the update will be performed only if the document in the
    database matches the query
  * **update** – Django-style update keyword arguments

#### my_metaclass

alias of `TopLevelDocumentMetaclass`

#### *property* pk

Get the primary key.

#### *classmethod* register_delete_rule(document_cls, field_name, rule)

This method registers the delete rules to apply when removing this
object.

#### reload(\*fields, \*\*kwargs)

Reloads the document from the database.

* **Parameters:**
  **\*fields** – an optional args list of specific fields to reload

#### save(upsert=False, validate=True, safe=False, \*\*kwargs)

Saves the document to the database.

If the document already exists, it will be updated, otherwise it will
be created.

* **Parameters:**
  * **upsert** (*False*) – whether to insert the document if it has an `id`
    populated but no document with that ID exists in the database
  * **validate** (*True*) – whether to validate the document
  * **safe** (*False*) – whether to `reload()` the document before raising
    any errors
* **Returns:**
  self

#### select_related(max_depth=1)

Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to
a maximum depth in order to cut down the number queries to mongodb.

#### set_field(field_name, value, create=True, validate=True, dynamic=False, \_enforce_read_only=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### switch_collection(collection_name, keep_created=True)

Temporarily switch the collection for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_collection('old-users')
user.save()
```

* **Parameters:**
  * **collection_name** (*str*) – The database alias to use for saving the
    document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching collection, else is reset to True

#### SEE ALSO
Use `switch_db`
if you need to read from another database

#### switch_db(db_alias, keep_created=True)

Temporarily switch the database for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_db('archive-db')
user.save()
```

* **Parameters:**
  * **db_alias** (*str*) – The database alias to use for saving the document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching db, else is reset to True

#### SEE ALSO
Use `switch_collection`
if you need to read from another collection

#### to_dbref()

Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in
`__raw__` queries.

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### update(\*\*kwargs)

Performs an update on the `Document`
A convenience wrapper to `update()`.

Raises `OperationError` if called on an object that has not yet
been saved.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.NoDatasetSampleDocument(\*\*kwargs)

Bases: [`NoDatasetMixin`](fiftyone.core.odm.mixins.md#fiftyone.core.odm.mixins.NoDatasetMixin), [`SerializableDocument`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.SerializableDocument)

Backing document for samples that have not been added to a dataset.

**Attributes:**

| [`default_fields`](#fiftyone.core.odm.NoDatasetSampleDocument.default_fields)                 |                                                         |
|-----------------------------------------------------------------------------------------------|---------------------------------------------------------|
| [`default_fields_ordered`](#fiftyone.core.odm.NoDatasetSampleDocument.default_fields_ordered) |                                                         |
| [`media_type`](#fiftyone.core.odm.NoDatasetSampleDocument.media_type)                         |                                                         |
| [`field_names`](#fiftyone.core.odm.NoDatasetSampleDocument.field_names)                       | An ordered tuple of the public fields of this document. |
| [`in_db`](#fiftyone.core.odm.NoDatasetSampleDocument.in_db)                                   |                                                         |

**Methods:**

| [`clear_field`](#fiftyone.core.odm.NoDatasetSampleDocument.clear_field)(field_name)                     | Clears the field from the document.                                                      |
|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| [`copy`](#fiftyone.core.odm.NoDatasetSampleDocument.copy)()                                             | Returns a deep copy of the document.                                                     |
| [`delete`](#fiftyone.core.odm.NoDatasetSampleDocument.delete)()                                         |                                                                                          |
| [`fancy_repr`](#fiftyone.core.odm.NoDatasetSampleDocument.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                          |
| [`from_dict`](#fiftyone.core.odm.NoDatasetSampleDocument.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                          |
| [`from_json`](#fiftyone.core.odm.NoDatasetSampleDocument.from_json)(s)                                  | Loads the document from a JSON string.                                                   |
| [`get_field`](#fiftyone.core.odm.NoDatasetSampleDocument.get_field)(field_name)                         | Gets the field of the document.                                                          |
| [`has_field`](#fiftyone.core.odm.NoDatasetSampleDocument.has_field)(field_name)                         | Determines whether the document has a field of the given name.                           |
| [`iter_fields`](#fiftyone.core.odm.NoDatasetSampleDocument.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document. |
| [`merge`](#fiftyone.core.odm.NoDatasetSampleDocument.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                            |
| [`reload`](#fiftyone.core.odm.NoDatasetSampleDocument.reload)()                                         |                                                                                          |
| [`save`](#fiftyone.core.odm.NoDatasetSampleDocument.save)()                                             |                                                                                          |
| [`set_field`](#fiftyone.core.odm.NoDatasetSampleDocument.set_field)(field_name, value[, create, ...])   | Sets the value of a field of the document.                                               |
| [`to_dict`](#fiftyone.core.odm.NoDatasetSampleDocument.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                      |
| [`to_json`](#fiftyone.core.odm.NoDatasetSampleDocument.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                |

#### default_fields *= {'_dataset_id': <fiftyone.core.fields.ObjectIdField object>, '_media_type': <fiftyone.core.fields.StringField object>, '_rand': <fiftyone.core.fields.FloatField object>, 'created_at': <fiftyone.core.fields.DateTimeField object>, 'filepath': <fiftyone.core.fields.StringField object>, 'id': <fiftyone.core.fields.ObjectIdField object>, 'last_modified_at': <fiftyone.core.fields.DateTimeField object>, 'media_reference': <fiftyone.core.fields.MediaReferenceField object>, 'metadata': <fiftyone.core.fields.EmbeddedDocumentField object>, 'tags': <fiftyone.core.fields.ListField object>}*

#### default_fields_ordered *= ('id', 'filepath', 'media_reference', 'tags', 'metadata', 'created_at', 'last_modified_at', '_media_type', '_rand', '_dataset_id')*

#### *property* media_type

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### delete()

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### *property* in_db

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### reload()

#### save()

#### set_field(field_name, value, create=True, validate=True, dynamic=False)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

### fiftyone.core.odm.serialize_value(value, extended=False)

Serializes the given value.

* **Parameters:**
  * **value** – the value
  * **extended** (*False*) – whether to serialize extended JSON constructs such as
    ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  the serialized value

### fiftyone.core.odm.deserialize_value(value)

Deserializes the given value.

* **Parameters:**
  **value** – the serialized value
* **Returns:**
  the value

### fiftyone.core.odm.validate_field_name(field_name, media_type=None, is_frame_field=False)

Verifies that the given field name is valid.

* **Parameters:**
  * **field_name** – the field name
  * **media_type** (*None*) – the media type of the sample, if known
  * **is_frame_field** (*False*) – whether this is a frame-level field
* **Raises:**
  **ValueError** – if the field name is invalid

### fiftyone.core.odm.create_field(name, ftype, embedded_doc_type=None, subfield=None, fields=None, db_field=None, description=None, info=None, read_only=False, created_at=None, \*\*kwargs)

Creates the field defined by the given specification.

#### NOTE
This method is used exclusively to create user-defined (non-default)
fields. Any parameters accepted here must be stored on
[`fiftyone.core.odm.dataset.SampleFieldDocument`](fiftyone.core.odm.dataset.md#fiftyone.core.odm.dataset.SampleFieldDocument) or else datasets
will “lose” any additional decorations when they are loaded from the
database.

* **Parameters:**
  * **name** – the field name
  * **ftype** – the field type to create. Must be a subclass of
    [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
  * **embedded_doc_type** (*None*) – the
    [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type of the field.
    Only applicable when `ftype` is
    [`fiftyone.core.fields.EmbeddedDocumentField`](fiftyone.core.fields.md#fiftyone.core.fields.EmbeddedDocumentField)
  * **subfield** (*None*) – the [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field) type of the
    contained field. Only applicable when `ftype` is
    [`fiftyone.core.fields.ListField`](fiftyone.core.fields.md#fiftyone.core.fields.ListField) or
    [`fiftyone.core.fields.DictField`](fiftyone.core.fields.md#fiftyone.core.fields.DictField)
  * **fields** (*None*) – a list of [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field) instances
    defining embedded document attributes. Only applicable when
    `ftype` is [`fiftyone.core.fields.EmbeddedDocumentField`](fiftyone.core.fields.md#fiftyone.core.fields.EmbeddedDocumentField)
  * **db_field** (*None*) – the database field to store this field in. By default,
    `name` is used
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field should be read-only
  * **created_at** (*None*) – the datetime the field was created
* **Returns:**
  a [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)

### fiftyone.core.odm.create_implied_field(path, value, dynamic=False)

Creates the field for the given value.

* **Parameters:**
  * **path** – the field name or path
  * **value** – a value
  * **dynamic** (*False*) – whether to declare dynamic embedded document fields
* **Returns:**
  a [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)

### fiftyone.core.odm.get_field_kwargs(field)

Constructs the field keyword arguments dictionary for the given field.

* **Parameters:**
  **field** – a [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field) or `str(field)`
  representation of one
* **Returns:**
  a field specification dict

### fiftyone.core.odm.get_implied_field_kwargs(value, dynamic=False)

Infers the field keyword arguments dictionary for a field that can hold
the given value.

* **Parameters:**
  * **value** – a value
  * **dynamic** (*False*) – whether to declare dynamic embedded document fields
* **Returns:**
  a field specification dict

### fiftyone.core.odm.validate_fields_match(name, field, existing_field)

Validates that the types of the given fields match.

Embedded document fields are not validated, if applicable.

* **Parameters:**
  * **name** – the field name or `embedded.field.name`
  * **field** – a [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
  * **existing_field** – the reference [`fiftyone.core.fields.Field`](fiftyone.core.fields.md#fiftyone.core.fields.Field)
* **Raises:**
  **ValueError** – if the fields do not match

### *class* fiftyone.core.odm.SavedViewDocument(\*\*kwargs)

Bases: [`Document`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document)

Backing document for saved views.

**Attributes:**

| [`dataset_id`](#fiftyone.core.odm.SavedViewDocument.dataset_id)             | An Object ID field.                                                                                                          |
|-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| [`name`](#fiftyone.core.odm.SavedViewDocument.name)                         | A unicode string field.                                                                                                      |
| [`description`](#fiftyone.core.odm.SavedViewDocument.description)           | A unicode string field.                                                                                                      |
| [`slug`](#fiftyone.core.odm.SavedViewDocument.slug)                         | A unicode string field.                                                                                                      |
| [`color`](#fiftyone.core.odm.SavedViewDocument.color)                       | A string field that holds a hex color string like '#FF6D04'.                                                                 |
| [`view_stages`](#fiftyone.core.odm.SavedViewDocument.view_stages)           | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database. |
| [`created_at`](#fiftyone.core.odm.SavedViewDocument.created_at)             | A datetime field.                                                                                                            |
| [`last_modified_at`](#fiftyone.core.odm.SavedViewDocument.last_modified_at) | A datetime field.                                                                                                            |
| [`last_loaded_at`](#fiftyone.core.odm.SavedViewDocument.last_loaded_at)     | A datetime field.                                                                                                            |
| [`STRICT`](#fiftyone.core.odm.SavedViewDocument.STRICT)                     |                                                                                                                              |
| [`field_names`](#fiftyone.core.odm.SavedViewDocument.field_names)           | An ordered tuple of the public fields of this document.                                                                      |
| [`id`](#fiftyone.core.odm.SavedViewDocument.id)                             | A field wrapper around MongoDB's ObjectIds.                                                                                  |
| [`in_db`](#fiftyone.core.odm.SavedViewDocument.in_db)                       | Whether the document has been inserted into the database.                                                                    |
| [`pk`](#fiftyone.core.odm.SavedViewDocument.pk)                             | Get the primary key.                                                                                                         |

**Miscellaneous:**

| [`DoesNotExist`](#fiftyone.core.odm.SavedViewDocument.DoesNotExist)                       |    |
|-------------------------------------------------------------------------------------------|----|
| [`MultipleObjectsReturned`](#fiftyone.core.odm.SavedViewDocument.MultipleObjectsReturned) |    |

**Methods:**

| [`cascade_save`](#fiftyone.core.odm.SavedViewDocument.cascade_save)(\*\*kwargs)                        | Recursively save any references and generic references on the document.                                                                                                                          |
|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`clean`](#fiftyone.core.odm.SavedViewDocument.clean)()                                                | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                                                                         |
| [`clear_field`](#fiftyone.core.odm.SavedViewDocument.clear_field)(field_name)                          | Clears the field from the document.                                                                                                                                                              |
| [`compare_indexes`](#fiftyone.core.odm.SavedViewDocument.compare_indexes)()                            | Compares the indexes defined in MongoEngine with the ones existing in the database.                                                                                                              |
| [`copy`](#fiftyone.core.odm.SavedViewDocument.copy)([new_id])                                          | Returns a deep copy of the document.                                                                                                                                                             |
| [`copy_with_new_id`](#fiftyone.core.odm.SavedViewDocument.copy_with_new_id)()                          |                                                                                                                                                                                                  |
| [`create_index`](#fiftyone.core.odm.SavedViewDocument.create_index)(keys[, background])                | Creates the given indexes if required.                                                                                                                                                           |
| [`delete`](#fiftyone.core.odm.SavedViewDocument.delete)([signal_kwargs])                               | Delete the `Document` from the database.                                                                                                                                                         |
| [`drop_collection`](#fiftyone.core.odm.SavedViewDocument.drop_collection)()                            | Drops the entire collection associated with this `Document` type from the database.                                                                                                              |
| [`ensure_indexes`](#fiftyone.core.odm.SavedViewDocument.ensure_indexes)()                              | Checks the document meta data and ensures all the indexes exist.                                                                                                                                 |
| [`fancy_repr`](#fiftyone.core.odm.SavedViewDocument.fancy_repr)([class_name, select_fields, ...])      | Generates a customizable string representation of the document.                                                                                                                                  |
| [`field_to_mongo`](#fiftyone.core.odm.SavedViewDocument.field_to_mongo)(field_name)                    |                                                                                                                                                                                                  |
| [`field_to_python`](#fiftyone.core.odm.SavedViewDocument.field_to_python)(field_name, value)           |                                                                                                                                                                                                  |
| [`from_dict`](#fiftyone.core.odm.SavedViewDocument.from_dict)(d[, extended])                           | Loads the document from a BSON/JSON dictionary.                                                                                                                                                  |
| [`from_json`](#fiftyone.core.odm.SavedViewDocument.from_json)(s)                                       | Loads the document from a JSON string.                                                                                                                                                           |
| [`get_field`](#fiftyone.core.odm.SavedViewDocument.get_field)(field_name)                              | Gets the field of the document.                                                                                                                                                                  |
| [`get_text_score`](#fiftyone.core.odm.SavedViewDocument.get_text_score)()                              | Get text score from text query                                                                                                                                                                   |
| [`has_field`](#fiftyone.core.odm.SavedViewDocument.has_field)(field_name)                              | Determines whether the document has a field of the given name.                                                                                                                                   |
| [`iter_fields`](#fiftyone.core.odm.SavedViewDocument.iter_fields)()                                    | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                                                                         |
| [`list_indexes`](#fiftyone.core.odm.SavedViewDocument.list_indexes)()                                  | Lists all indexes that should be created for the Document collection.                                                                                                                            |
| [`merge`](#fiftyone.core.odm.SavedViewDocument.merge)(doc[, merge_lists, merge_dicts, overwrite])      | Merges the contents of the given document into this document.                                                                                                                                    |
| [`modify`](#fiftyone.core.odm.SavedViewDocument.modify)([query])                                       | Perform an atomic update of the document in the database and reload the document object using updated version.                                                                                   |
| [`register_delete_rule`](#fiftyone.core.odm.SavedViewDocument.register_delete_rule)(document_cls, ...) | This method registers the delete rules to apply when removing this object.                                                                                                                       |
| [`reload`](#fiftyone.core.odm.SavedViewDocument.reload)(\*fields, \*\*kwargs)                          | Reloads the document from the database.                                                                                                                                                          |
| [`save`](#fiftyone.core.odm.SavedViewDocument.save)([upsert, validate, safe])                          | Saves the document to the database.                                                                                                                                                              |
| [`select_related`](#fiftyone.core.odm.SavedViewDocument.select_related)([max_depth])                   | Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to a maximum depth in order to cut down the number queries to mongodb. |
| [`set_field`](#fiftyone.core.odm.SavedViewDocument.set_field)(field_name, value[, create])             | Sets the value of a field of the document.                                                                                                                                                       |
| [`switch_collection`](#fiftyone.core.odm.SavedViewDocument.switch_collection)(collection_name[, ...])  | Temporarily switch the collection for a document instance.                                                                                                                                       |
| [`switch_db`](#fiftyone.core.odm.SavedViewDocument.switch_db)(db_alias[, keep_created])                | Temporarily switch the database for a document instance.                                                                                                                                         |
| [`to_dbref`](#fiftyone.core.odm.SavedViewDocument.to_dbref)()                                          | Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in `__raw__` queries.                                                     |
| [`to_dict`](#fiftyone.core.odm.SavedViewDocument.to_dict)([extended])                                  | Serializes this document to a BSON/JSON dictionary.                                                                                                                                              |
| [`to_json`](#fiftyone.core.odm.SavedViewDocument.to_json)([pretty_print])                              | Serializes the document to a JSON string.                                                                                                                                                        |
| [`to_mongo`](#fiftyone.core.odm.SavedViewDocument.to_mongo)(\*args, \*\*kwargs)                        | Return as SON data ready for use with MongoDB.                                                                                                                                                   |
| [`update`](#fiftyone.core.odm.SavedViewDocument.update)(\*\*kwargs)                                    | Performs an update on the `Document` A convenience wrapper to `update()`.                                                                                                                        |
| [`validate`](#fiftyone.core.odm.SavedViewDocument.validate)([clean])                                   | Ensure that all fields' values are valid and that required fields are present.                                                                                                                   |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.SavedViewDocument.my_metaclass)   |    |
|-----------------------------------------------------------------------|----|

#### dataset_id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### name

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### description

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### slug

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### color

A string field that holds a hex color string like ‘#FF6D04’.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### view_stages

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### created_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### last_modified_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### last_loaded_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *exception* DoesNotExist

Bases: `DoesNotExist`

**Methods:**

| [`add_note`](#fiftyone.core.odm.SavedViewDocument.DoesNotExist.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.SavedViewDocument.DoesNotExist.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.SavedViewDocument.DoesNotExist.args)   |    |
|--------------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

#### *exception* MultipleObjectsReturned

Bases: `MultipleObjectsReturned`

**Methods:**

| [`add_note`](#fiftyone.core.odm.SavedViewDocument.MultipleObjectsReturned.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.SavedViewDocument.MultipleObjectsReturned.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.SavedViewDocument.MultipleObjectsReturned.args)   |    |
|-------------------------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

#### STRICT *= False*

#### cascade_save(\*\*kwargs)

Recursively save any references and generic references on the
document.

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### *classmethod* compare_indexes()

Compares the indexes defined in MongoEngine with the ones
existing in the database. Returns any missing/extra indexes.

#### copy(new_id=False)

Returns a deep copy of the document.

* **Parameters:**
  **new_id** (*False*) – whether to generate a new ID for the copied
  document. By default, the ID is left as `None` and will be
  automatically populated when the document is added to the
  database

#### copy_with_new_id()

#### *classmethod* create_index(keys, background=False, \*\*kwargs)

Creates the given indexes if required.

* **Parameters:**
  * **keys** – a single index key or a list of index keys (to
    construct a multi-field index); keys may be prefixed with a **+**
    or a **-** to determine the index ordering
  * **background** – Allows index creation in the background

#### delete(signal_kwargs=None, \*\*write_concern)

Delete the `Document` from the database. This
will only take effect if the document has been previously saved.

* **Parameters:**
  * **signal_kwargs** – (optional) kwargs dictionary to be passed to
    the signal calls.
  * **write_concern** – Extra keyword arguments are passed down which
    will be used as options for the resultant `getLastError` command.
    For example, `save(..., w: 2, fsync: True)` will
    wait until at least two servers have recorded the write and
    will force an fsync on the primary server.

#### *classmethod* drop_collection()

Drops the entire collection associated with this
`Document` type from the database.

Raises `OperationError` if the document has no collection set
(i.g. if it is `abstract`)

#### *classmethod* ensure_indexes()

Checks the document meta data and ensures all the indexes exist.

Global defaults can be set in the meta - see guide/defining-documents

By default, this will get called automatically upon first interaction with the
Document collection (query, save, etc) so unless you disabled `auto_create_index`, you
shouldn’t have to call this manually.

This also gets called upon every call to Document.save if `auto_create_index_on_save` is set to True

If called multiple times, MongoDB will not re-recreate indexes if they exist already

#### NOTE
You can disable automatic index creation by setting
`auto_create_index` to False in the documents meta data

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

A field wrapper around MongoDB’s ObjectIds.

#### *property* in_db

Whether the document has been inserted into the database.

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### *classmethod* list_indexes()

Lists all indexes that should be created for the Document collection.
It includes all the indexes from super- and sub-classes.

Note that it will only return the indexes’ fields, not the indexes’ options

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### modify(query=None, \*\*update)

Perform an atomic update of the document in the database and reload
the document object using updated version.

Returns True if the document has been updated or False if the document
in the database doesn’t match the query.

#### NOTE
All unsaved changes that have been made to the document are
rejected if the method returns True.

* **Parameters:**
  * **query** – the update will be performed only if the document in the
    database matches the query
  * **update** – Django-style update keyword arguments

#### my_metaclass

alias of `TopLevelDocumentMetaclass`

#### *property* pk

Get the primary key.

#### *classmethod* register_delete_rule(document_cls, field_name, rule)

This method registers the delete rules to apply when removing this
object.

#### reload(\*fields, \*\*kwargs)

Reloads the document from the database.

* **Parameters:**
  **\*fields** – an optional args list of specific fields to reload

#### save(upsert=False, validate=True, safe=False, \*\*kwargs)

Saves the document to the database.

If the document already exists, it will be updated, otherwise it will
be created.

* **Parameters:**
  * **upsert** (*False*) – whether to insert the document if it has an `id`
    populated but no document with that ID exists in the database
  * **validate** (*True*) – whether to validate the document
  * **safe** (*False*) – whether to `reload()` the document before raising
    any errors
* **Returns:**
  self

#### select_related(max_depth=1)

Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to
a maximum depth in order to cut down the number queries to mongodb.

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### switch_collection(collection_name, keep_created=True)

Temporarily switch the collection for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_collection('old-users')
user.save()
```

* **Parameters:**
  * **collection_name** (*str*) – The database alias to use for saving the
    document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching collection, else is reset to True

#### SEE ALSO
Use `switch_db`
if you need to read from another database

#### switch_db(db_alias, keep_created=True)

Temporarily switch the database for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_db('archive-db')
user.save()
```

* **Parameters:**
  * **db_alias** (*str*) – The database alias to use for saving the document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching db, else is reset to True

#### SEE ALSO
Use `switch_collection`
if you need to read from another collection

#### to_dbref()

Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in
`__raw__` queries.

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### update(\*\*kwargs)

Performs an update on the `Document`
A convenience wrapper to `update()`.

Raises `OperationError` if called on an object that has not yet
been saved.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### fiftyone.core.odm.default_workspace_factory()

Creates a default top-level instance of [`Space`](#fiftyone.core.odm.Space)

* **Returns:**
  a default [`Space`](#fiftyone.core.odm.Space) instance

### *class* fiftyone.core.odm.Panel(\*args, \*\*kwargs)

Bases: [`AppComponent`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent)

Document for a panel (tab) within a Workspace in the App.

* **Parameters:**
  * **component_id** – the component ID
  * **type** – the Panel type
  * **pinned** – whether the Panel is currently pinned
  * **state** – an optional Panel state dict

**Attributes:**

| [`type`](#fiftyone.core.odm.Panel.type)                 | A unicode string field.                                     |
|---------------------------------------------------------|-------------------------------------------------------------|
| [`pinned`](#fiftyone.core.odm.Panel.pinned)             | A boolean field.                                            |
| [`state`](#fiftyone.core.odm.Panel.state)               | A dictionary field that wraps a standard Python dictionary. |
| [`STRICT`](#fiftyone.core.odm.Panel.STRICT)             |                                                             |
| [`component_id`](#fiftyone.core.odm.Panel.component_id) | A unicode string field.                                     |
| [`field_names`](#fiftyone.core.odm.Panel.field_names)   | An ordered tuple of the public fields of this document.     |

**Methods:**

| [`clean`](#fiftyone.core.odm.Panel.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.odm.Panel.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.odm.Panel.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.odm.Panel.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.odm.Panel.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.odm.Panel.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.odm.Panel.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.odm.Panel.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.odm.Panel.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.odm.Panel.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.odm.Panel.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.odm.Panel.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.odm.Panel.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.odm.Panel.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.odm.Panel.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.odm.Panel.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.odm.Panel.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.odm.Panel.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.Panel.my_metaclass)   |    |
|-----------------------------------------------------------|----|

#### type

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### pinned

A boolean field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### state

A dictionary field that wraps a standard Python dictionary.

If this field is not set, its default value is `{}`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the type
    of the values in the dict
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### component_id

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.Space(\*args, \*\*kwargs)

Bases: [`AppComponent`](fiftyone.core.odm.workspace.md#fiftyone.core.odm.workspace.AppComponent)

Document for configuration of a Space in the App.

* **Parameters:**
  * **component_id** – the component’s ID
  * **children** – the list of `Component` children of this space, if any
  * **orientation** ( *[* *"horizontal"* *,*  *"vertical"* *]*) – the orientation of this
    space’s children
  * **active_child** – the `component_id` of this space’s currently active
    child
  * **sizes** – the ordered list of relative sizes for children of a space in
    `[0, 1]`

**Attributes:**

| [`children`](#fiftyone.core.odm.Space.children)         | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.   |
|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| [`orientation`](#fiftyone.core.odm.Space.orientation)   | A unicode string field.                                                                                                        |
| [`active_child`](#fiftyone.core.odm.Space.active_child) | A unicode string field.                                                                                                        |
| [`sizes`](#fiftyone.core.odm.Space.sizes)               | A list field that wraps a standard `Field`, allowing multiple instances of the field to be stored as a list in the database.   |
| [`name`](#fiftyone.core.odm.Space.name)                 |                                                                                                                                |
| [`STRICT`](#fiftyone.core.odm.Space.STRICT)             |                                                                                                                                |
| [`component_id`](#fiftyone.core.odm.Space.component_id) | A unicode string field.                                                                                                        |
| [`field_names`](#fiftyone.core.odm.Space.field_names)   | An ordered tuple of the public fields of this document.                                                                        |

**Methods:**

| [`clean`](#fiftyone.core.odm.Space.clean)()                                           | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.   |
|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [`clear_field`](#fiftyone.core.odm.Space.clear_field)(field_name)                     | Clears the field from the document.                                                                        |
| [`copy`](#fiftyone.core.odm.Space.copy)()                                             | Returns a deep copy of the document.                                                                       |
| [`fancy_repr`](#fiftyone.core.odm.Space.fancy_repr)([class_name, select_fields, ...]) | Generates a customizable string representation of the document.                                            |
| [`field_to_mongo`](#fiftyone.core.odm.Space.field_to_mongo)(field_name)               |                                                                                                            |
| [`field_to_python`](#fiftyone.core.odm.Space.field_to_python)(field_name, value)      |                                                                                                            |
| [`from_dict`](#fiftyone.core.odm.Space.from_dict)(d[, extended])                      | Loads the document from a BSON/JSON dictionary.                                                            |
| [`from_json`](#fiftyone.core.odm.Space.from_json)(s)                                  | Loads the document from a JSON string.                                                                     |
| [`get_field`](#fiftyone.core.odm.Space.get_field)(field_name)                         | Gets the field of the document.                                                                            |
| [`get_text_score`](#fiftyone.core.odm.Space.get_text_score)()                         | Get text score from text query                                                                             |
| [`has_field`](#fiftyone.core.odm.Space.has_field)(field_name)                         | Determines whether the document has a field of the given name.                                             |
| [`iter_fields`](#fiftyone.core.odm.Space.iter_fields)()                               | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                   |
| [`merge`](#fiftyone.core.odm.Space.merge)(doc[, merge_lists, merge_dicts, overwrite]) | Merges the contents of the given document into this document.                                              |
| [`set_field`](#fiftyone.core.odm.Space.set_field)(field_name, value[, create])        | Sets the value of a field of the document.                                                                 |
| [`to_dict`](#fiftyone.core.odm.Space.to_dict)([extended])                             | Serializes this document to a BSON/JSON dictionary.                                                        |
| [`to_json`](#fiftyone.core.odm.Space.to_json)([pretty_print])                         | Serializes the document to a JSON string.                                                                  |
| [`to_mongo`](#fiftyone.core.odm.Space.to_mongo)(\*args, \*\*kwargs)                   | Return as SON data ready for use with MongoDB.                                                             |
| [`validate`](#fiftyone.core.odm.Space.validate)([clean])                              | Ensure that all fields' values are valid and that required fields are present.                             |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.Space.my_metaclass)   |    |
|-----------------------------------------------------------|----|

#### children

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### orientation

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### active_child

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### sizes

A list field that wraps a standard `Field`, allowing multiple
instances of the field to be stored as a list in the database.

If this field is not set, its default value is `[]`.

* **Parameters:**
  * **field** (*None*) – an optional `Field` instance describing the
    type of the list elements
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *property* name

#### STRICT *= False*

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### component_id

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### copy()

Returns a deep copy of the document.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### my_metaclass

alias of `DocumentMetaclass`

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.

### *class* fiftyone.core.odm.WorkspaceDocument(\*args, \*\*kwargs)

Bases: [`Document`](fiftyone.core.odm.document.md#fiftyone.core.odm.document.Document)

Document for configuration of a saved workspace in the App.

Contains a single [`Space`](#fiftyone.core.odm.Space) as a child, which can in turn contain
multiple children.

**Attributes:**

| [`child`](#fiftyone.core.odm.WorkspaceDocument.child)                       | A field that stores instances of a given type of [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object.   |
|-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| [`color`](#fiftyone.core.odm.WorkspaceDocument.color)                       | A string field that holds a hex color string like '#FF6D04'.                                                                                   |
| [`created_at`](#fiftyone.core.odm.WorkspaceDocument.created_at)             | A datetime field.                                                                                                                              |
| [`dataset_id`](#fiftyone.core.odm.WorkspaceDocument.dataset_id)             | An Object ID field.                                                                                                                            |
| [`description`](#fiftyone.core.odm.WorkspaceDocument.description)           | A unicode string field.                                                                                                                        |
| [`last_loaded_at`](#fiftyone.core.odm.WorkspaceDocument.last_loaded_at)     | A datetime field.                                                                                                                              |
| [`last_modified_at`](#fiftyone.core.odm.WorkspaceDocument.last_modified_at) | A datetime field.                                                                                                                              |
| [`slug`](#fiftyone.core.odm.WorkspaceDocument.slug)                         | A unicode string field.                                                                                                                        |
| [`STRICT`](#fiftyone.core.odm.WorkspaceDocument.STRICT)                     |                                                                                                                                                |
| [`field_names`](#fiftyone.core.odm.WorkspaceDocument.field_names)           | An ordered tuple of the public fields of this document.                                                                                        |
| [`id`](#fiftyone.core.odm.WorkspaceDocument.id)                             | A field wrapper around MongoDB's ObjectIds.                                                                                                    |
| [`in_db`](#fiftyone.core.odm.WorkspaceDocument.in_db)                       | Whether the document has been inserted into the database.                                                                                      |
| [`name`](#fiftyone.core.odm.WorkspaceDocument.name)                         |                                                                                                                                                |
| [`pk`](#fiftyone.core.odm.WorkspaceDocument.pk)                             | Get the primary key.                                                                                                                           |

**Miscellaneous:**

| [`DoesNotExist`](#fiftyone.core.odm.WorkspaceDocument.DoesNotExist)                       |    |
|-------------------------------------------------------------------------------------------|----|
| [`MultipleObjectsReturned`](#fiftyone.core.odm.WorkspaceDocument.MultipleObjectsReturned) |    |

**Methods:**

| [`cascade_save`](#fiftyone.core.odm.WorkspaceDocument.cascade_save)(\*\*kwargs)                        | Recursively save any references and generic references on the document.                                                                                                                          |
|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`clean`](#fiftyone.core.odm.WorkspaceDocument.clean)()                                                | Hook for doing document level data cleaning (usually validation or assignment) before validation is run.                                                                                         |
| [`clear_field`](#fiftyone.core.odm.WorkspaceDocument.clear_field)(field_name)                          | Clears the field from the document.                                                                                                                                                              |
| [`compare_indexes`](#fiftyone.core.odm.WorkspaceDocument.compare_indexes)()                            | Compares the indexes defined in MongoEngine with the ones existing in the database.                                                                                                              |
| [`copy`](#fiftyone.core.odm.WorkspaceDocument.copy)([new_id])                                          | Returns a deep copy of the document.                                                                                                                                                             |
| [`copy_with_new_id`](#fiftyone.core.odm.WorkspaceDocument.copy_with_new_id)()                          |                                                                                                                                                                                                  |
| [`create_index`](#fiftyone.core.odm.WorkspaceDocument.create_index)(keys[, background])                | Creates the given indexes if required.                                                                                                                                                           |
| [`delete`](#fiftyone.core.odm.WorkspaceDocument.delete)([signal_kwargs])                               | Delete the `Document` from the database.                                                                                                                                                         |
| [`drop_collection`](#fiftyone.core.odm.WorkspaceDocument.drop_collection)()                            | Drops the entire collection associated with this `Document` type from the database.                                                                                                              |
| [`ensure_indexes`](#fiftyone.core.odm.WorkspaceDocument.ensure_indexes)()                              | Checks the document meta data and ensures all the indexes exist.                                                                                                                                 |
| [`fancy_repr`](#fiftyone.core.odm.WorkspaceDocument.fancy_repr)([class_name, select_fields, ...])      | Generates a customizable string representation of the document.                                                                                                                                  |
| [`field_to_mongo`](#fiftyone.core.odm.WorkspaceDocument.field_to_mongo)(field_name)                    |                                                                                                                                                                                                  |
| [`field_to_python`](#fiftyone.core.odm.WorkspaceDocument.field_to_python)(field_name, value)           |                                                                                                                                                                                                  |
| [`from_dict`](#fiftyone.core.odm.WorkspaceDocument.from_dict)(d[, extended])                           | Loads the document from a BSON/JSON dictionary.                                                                                                                                                  |
| [`from_json`](#fiftyone.core.odm.WorkspaceDocument.from_json)(s)                                       | Loads the document from a JSON string.                                                                                                                                                           |
| [`get_field`](#fiftyone.core.odm.WorkspaceDocument.get_field)(field_name)                              | Gets the field of the document.                                                                                                                                                                  |
| [`get_text_score`](#fiftyone.core.odm.WorkspaceDocument.get_text_score)()                              | Get text score from text query                                                                                                                                                                   |
| [`has_field`](#fiftyone.core.odm.WorkspaceDocument.has_field)(field_name)                              | Determines whether the document has a field of the given name.                                                                                                                                   |
| [`iter_fields`](#fiftyone.core.odm.WorkspaceDocument.iter_fields)()                                    | Returns an iterator over the `(name, value)` pairs of the public fields of the document.                                                                                                         |
| [`list_indexes`](#fiftyone.core.odm.WorkspaceDocument.list_indexes)()                                  | Lists all indexes that should be created for the Document collection.                                                                                                                            |
| [`merge`](#fiftyone.core.odm.WorkspaceDocument.merge)(doc[, merge_lists, merge_dicts, overwrite])      | Merges the contents of the given document into this document.                                                                                                                                    |
| [`modify`](#fiftyone.core.odm.WorkspaceDocument.modify)([query])                                       | Perform an atomic update of the document in the database and reload the document object using updated version.                                                                                   |
| [`register_delete_rule`](#fiftyone.core.odm.WorkspaceDocument.register_delete_rule)(document_cls, ...) | This method registers the delete rules to apply when removing this object.                                                                                                                       |
| [`reload`](#fiftyone.core.odm.WorkspaceDocument.reload)(\*fields, \*\*kwargs)                          | Reloads the document from the database.                                                                                                                                                          |
| [`save`](#fiftyone.core.odm.WorkspaceDocument.save)([upsert, validate, safe])                          | Saves the document to the database.                                                                                                                                                              |
| [`select_related`](#fiftyone.core.odm.WorkspaceDocument.select_related)([max_depth])                   | Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to a maximum depth in order to cut down the number queries to mongodb. |
| [`set_field`](#fiftyone.core.odm.WorkspaceDocument.set_field)(field_name, value[, create])             | Sets the value of a field of the document.                                                                                                                                                       |
| [`switch_collection`](#fiftyone.core.odm.WorkspaceDocument.switch_collection)(collection_name[, ...])  | Temporarily switch the collection for a document instance.                                                                                                                                       |
| [`switch_db`](#fiftyone.core.odm.WorkspaceDocument.switch_db)(db_alias[, keep_created])                | Temporarily switch the database for a document instance.                                                                                                                                         |
| [`to_dbref`](#fiftyone.core.odm.WorkspaceDocument.to_dbref)()                                          | Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in `__raw__` queries.                                                     |
| [`to_dict`](#fiftyone.core.odm.WorkspaceDocument.to_dict)([extended])                                  | Serializes this document to a BSON/JSON dictionary.                                                                                                                                              |
| [`to_json`](#fiftyone.core.odm.WorkspaceDocument.to_json)([pretty_print])                              | Serializes the document to a JSON string.                                                                                                                                                        |
| [`to_mongo`](#fiftyone.core.odm.WorkspaceDocument.to_mongo)(\*args, \*\*kwargs)                        | Return as SON data ready for use with MongoDB.                                                                                                                                                   |
| [`update`](#fiftyone.core.odm.WorkspaceDocument.update)(\*\*kwargs)                                    | Performs an update on the `Document` A convenience wrapper to `update()`.                                                                                                                        |
| [`validate`](#fiftyone.core.odm.WorkspaceDocument.validate)([clean])                                   | Ensure that all fields' values are valid and that required fields are present.                                                                                                                   |

**Classes:**

| [`my_metaclass`](#fiftyone.core.odm.WorkspaceDocument.my_metaclass)   |    |
|-----------------------------------------------------------------------|----|

#### child

A field that stores instances of a given type of
[`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) object.

* **Parameters:**
  * **document_type** – the [`fiftyone.core.odm.BaseEmbeddedDocument`](#fiftyone.core.odm.BaseEmbeddedDocument) type
    stored in this field
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### color

A string field that holds a hex color string like ‘#FF6D04’.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### created_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### dataset_id

An Object ID field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### description

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### last_loaded_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### last_modified_at

A datetime field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### slug

A unicode string field.

* **Parameters:**
  * **description** (*None*) – an optional description
  * **info** (*None*) – an optional info dict
  * **read_only** (*False*) – whether the field is read-only
  * **created_at** (*None*) – the datetime the field was created

#### *exception* DoesNotExist

Bases: `DoesNotExist`

**Methods:**

| [`add_note`](#fiftyone.core.odm.WorkspaceDocument.DoesNotExist.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.WorkspaceDocument.DoesNotExist.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.WorkspaceDocument.DoesNotExist.args)   |    |
|--------------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

#### *exception* MultipleObjectsReturned

Bases: `MultipleObjectsReturned`

**Methods:**

| [`add_note`](#fiftyone.core.odm.WorkspaceDocument.MultipleObjectsReturned.add_note)(object, /)             | Exception.add_note(note) -- add a note to the exception                         |
|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [`with_traceback`](#fiftyone.core.odm.WorkspaceDocument.MultipleObjectsReturned.with_traceback)(object, /) | Exception.with_traceback(tb) -- set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#fiftyone.core.odm.WorkspaceDocument.MultipleObjectsReturned.args)   |    |
|-------------------------------------------------------------------------------|----|

#### add_note(object,)

Exception.add_note(note) –
add a note to the exception

#### args

#### with_traceback(object,)

Exception.with_traceback(tb) –
set self._\_traceback_\_ to tb and return self.

#### STRICT *= False*

#### cascade_save(\*\*kwargs)

Recursively save any references and generic references on the
document.

#### clean()

Hook for doing document level data cleaning (usually validation or assignment)
before validation is run.

Any ValidationError raised by this method will not be associated with
a particular field; it will have a special-case association with the
field defined by NON_FIELD_ERRORS.

#### clear_field(field_name)

Clears the field from the document.

* **Parameters:**
  **field_name** – the field name
* **Raises:**
  **ValueError** – if the field does not exist

#### *classmethod* compare_indexes()

Compares the indexes defined in MongoEngine with the ones
existing in the database. Returns any missing/extra indexes.

#### copy(new_id=False)

Returns a deep copy of the document.

* **Parameters:**
  **new_id** (*False*) – whether to generate a new ID for the copied
  document. By default, the ID is left as `None` and will be
  automatically populated when the document is added to the
  database

#### copy_with_new_id()

#### *classmethod* create_index(keys, background=False, \*\*kwargs)

Creates the given indexes if required.

* **Parameters:**
  * **keys** – a single index key or a list of index keys (to
    construct a multi-field index); keys may be prefixed with a **+**
    or a **-** to determine the index ordering
  * **background** – Allows index creation in the background

#### delete(signal_kwargs=None, \*\*write_concern)

Delete the `Document` from the database. This
will only take effect if the document has been previously saved.

* **Parameters:**
  * **signal_kwargs** – (optional) kwargs dictionary to be passed to
    the signal calls.
  * **write_concern** – Extra keyword arguments are passed down which
    will be used as options for the resultant `getLastError` command.
    For example, `save(..., w: 2, fsync: True)` will
    wait until at least two servers have recorded the write and
    will force an fsync on the primary server.

#### *classmethod* drop_collection()

Drops the entire collection associated with this
`Document` type from the database.

Raises `OperationError` if the document has no collection set
(i.g. if it is `abstract`)

#### *classmethod* ensure_indexes()

Checks the document meta data and ensures all the indexes exist.

Global defaults can be set in the meta - see guide/defining-documents

By default, this will get called automatically upon first interaction with the
Document collection (query, save, etc) so unless you disabled `auto_create_index`, you
shouldn’t have to call this manually.

This also gets called upon every call to Document.save if `auto_create_index_on_save` is set to True

If called multiple times, MongoDB will not re-recreate indexes if they exist already

#### NOTE
You can disable automatic index creation by setting
`auto_create_index` to False in the documents meta data

#### fancy_repr(class_name=None, select_fields=None, exclude_fields=None, \*\*kwargs)

Generates a customizable string representation of the document.

* **Parameters:**
  * **class_name** (*None*) – optional class name to use
  * **select_fields** (*None*) – iterable of field names to restrict to
  * **exclude_fields** (*None*) – iterable of field names to exclude
  * **\*\*kwargs** – additional key-value pairs to include in the string
    representation
* **Returns:**
  a string representation of the document

#### *property* field_names

An ordered tuple of the public fields of this document.

#### field_to_mongo(field_name)

#### field_to_python(field_name, value)

#### *classmethod* from_dict(d, extended=False)

Loads the document from a BSON/JSON dictionary.

* **Parameters:**
  * **d** – a dictionary
  * **extended** (*False*) – whether the input dictionary may contain
    serialized extended JSON constructs
* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### *classmethod* from_json(s)

Loads the document from a JSON string.

* **Returns:**
  a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument)

#### get_field(field_name)

Gets the field of the document.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  the field value
* **Raises:**
  **AttributeError** – if the field does not exist

#### get_text_score()

Get text score from text query

#### has_field(field_name)

Determines whether the document has a field of the given name.

* **Parameters:**
  **field_name** – the field name
* **Returns:**
  True/False

#### id

A field wrapper around MongoDB’s ObjectIds.

#### *property* in_db

Whether the document has been inserted into the database.

#### iter_fields()

Returns an iterator over the `(name, value)` pairs of the
public fields of the document.

* **Returns:**
  an iterator that emits `(name, value)` tuples

#### *classmethod* list_indexes()

Lists all indexes that should be created for the Document collection.
It includes all the indexes from super- and sub-classes.

Note that it will only return the indexes’ fields, not the indexes’ options

#### merge(doc, merge_lists=True, merge_dicts=True, overwrite=True)

Merges the contents of the given document into this document.

* **Parameters:**
  * **doc** – a [`SerializableDocument`](#fiftyone.core.odm.SerializableDocument) of same type as this document
  * **merge_lists** (*True*) – whether to merge the elements of top-level list
    fields rather than treating the list as a single value
  * **merge_dicts** (*True*) – whether to recursively merge the contents of
    top-level dict fields rather than treating the dict as a single
    value
  * **overwrite** (*True*) – whether to overwrite (True) or skip (False)
    existing fields

#### modify(query=None, \*\*update)

Perform an atomic update of the document in the database and reload
the document object using updated version.

Returns True if the document has been updated or False if the document
in the database doesn’t match the query.

#### NOTE
All unsaved changes that have been made to the document are
rejected if the method returns True.

* **Parameters:**
  * **query** – the update will be performed only if the document in the
    database matches the query
  * **update** – Django-style update keyword arguments

#### my_metaclass

alias of `TopLevelDocumentMetaclass`

#### *property* name

#### *property* pk

Get the primary key.

#### *classmethod* register_delete_rule(document_cls, field_name, rule)

This method registers the delete rules to apply when removing this
object.

#### reload(\*fields, \*\*kwargs)

Reloads the document from the database.

* **Parameters:**
  **\*fields** – an optional args list of specific fields to reload

#### save(upsert=False, validate=True, safe=False, \*\*kwargs)

Saves the document to the database.

If the document already exists, it will be updated, otherwise it will
be created.

* **Parameters:**
  * **upsert** (*False*) – whether to insert the document if it has an `id`
    populated but no document with that ID exists in the database
  * **validate** (*True*) – whether to validate the document
  * **safe** (*False*) – whether to `reload()` the document before raising
    any errors
* **Returns:**
  self

#### select_related(max_depth=1)

Handles dereferencing of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) objects to
a maximum depth in order to cut down the number queries to mongodb.

#### set_field(field_name, value, create=True)

Sets the value of a field of the document.

* **Parameters:**
  * **field_name** – the field name
  * **value** – the field value
  * **create** (*True*) – whether to create the field if it does not exist
* **Raises:**
  **ValueError** – if `field_name` is not an allowed field name or does
      not exist and `create == False`

#### switch_collection(collection_name, keep_created=True)

Temporarily switch the collection for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_collection('old-users')
user.save()
```

* **Parameters:**
  * **collection_name** (*str*) – The database alias to use for saving the
    document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching collection, else is reset to True

#### SEE ALSO
Use `switch_db`
if you need to read from another database

#### switch_db(db_alias, keep_created=True)

Temporarily switch the database for a document instance.

Only really useful for archiving off data and calling `save()`:

```default
user = User.objects.get(id=user_id)
user.switch_db('archive-db')
user.save()
```

* **Parameters:**
  * **db_alias** (*str*) – The database alias to use for saving the document
  * **keep_created** ([*bool*](fiftyone.core.stages.md#fiftyone.core.stages.Exists.bool)) – keep self._created value after switching db, else is reset to True

#### SEE ALSO
Use `switch_collection`
if you need to read from another collection

#### to_dbref()

Returns an instance of [`DBRef`](https://pymongo.readthedocs.io/en/stable/api/bson/dbref.html#bson.dbref.DBRef) useful in
`__raw__` queries.

#### to_dict(extended=False)

Serializes this document to a BSON/JSON dictionary.

* **Parameters:**
  **extended** (*False*) – whether to serialize extended JSON constructs
  such as ObjectIDs, Binary, etc. into JSON format
* **Returns:**
  a dict

#### to_json(pretty_print=False)

Serializes the document to a JSON string.

* **Parameters:**
  **pretty_print** (*False*) – whether to render the JSON in human readable
  format with newlines and indentations
* **Returns:**
  a JSON string

#### to_mongo(\*args, \*\*kwargs)

Return as SON data ready for use with MongoDB.

#### update(\*\*kwargs)

Performs an update on the `Document`
A convenience wrapper to `update()`.

Raises `OperationError` if called on an object that has not yet
been saved.

#### validate(clean=True)

Ensure that all fields’ values are valid and that required fields
are present.

Raises `ValidationError` if any of the fields’ values are found
to be invalid.
