class Document(_Document): (source)
Known subclasses: fiftyone.core.frame.Frame
, fiftyone.core.sample.Sample
Constructor: Document(**kwargs)
Abstract base class for objects that are associated with
fiftyone.core.dataset.Dataset
instances and are backed by
documents in database collections.
Document subclasses whose in-dataset instances should be singletons can
inherit this behavior by deriving from the
fiftyone.core.singletons.DocumentSingleton
metaclass.
Parameters | |
**kwargs | field names and values |
Class Method | from |
Loads the document from a JSON dictionary. |
Class Method | from |
Creates a document backed by the given database document. |
Class Method | from |
Loads the document from a JSON string. |
Method | __init__ |
Undocumented |
Method | copy |
Returns a deep copy of the document that has not been added to the database. |
Method | reload |
Reloads the document from the database. |
Method | _reload |
Reloads the backing doc from the database. |
Method | _reset |
Resets the backing doc for the document. |
Method | _set |
Sets the backing doc for the document. |
Constant | _NO |
Undocumented |
Instance Variable | _dataset |
Undocumented |
Instance Variable | _doc |
Undocumented |
Inherited from _Document
:
Method | __contains__ |
Undocumented |
Method | __copy__ |
Undocumented |
Method | __delattr__ |
Undocumented |
Method | __delitem__ |
Undocumented |
Method | __dir__ |
Undocumented |
Method | __eq__ |
Undocumented |
Method | __getattr__ |
Undocumented |
Method | __getitem__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __setattr__ |
Undocumented |
Method | __setitem__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | clear |
Clears the value of a field of the document. |
Method | get |
Gets the value of a field of the document. |
Method | has |
Determines whether the document has the given field. |
Method | iter |
Returns an iterator over the (name, value) pairs of the public fields of the document. |
Method | merge |
Merges the fields of the document into this document. |
Method | save |
Saves the document to the database. |
Method | set |
Sets the value of a field of the document. |
Method | to |
Serializes the document to a JSON dictionary. |
Method | to |
Serializes the document to a JSON string. |
Method | to |
Serializes the document to a BSON dictionary equivalent to the representation that would be stored in the database. |
Method | update |
Sets the dictionary of fields on the document. |
Property | dataset |
The dataset to which this document belongs, or None if it has not been added to a dataset. |
Property | field |
An ordered tuple of the public field names of this document. |
Property | in |
Whether the document has been added to a dataset. |
Method | _get |
Returns an ordered tuple of field names of this document. |
Method | _iter |
Undocumented |
Method | _parse |
Undocumented |
Method | _save |
Undocumented |
Property | _collection |
The fiftyone.core.collections.SampleCollection from which this document was taken, or None if it is not in a dataset. |
Property | _id |
The ObjectId of the document, or None if it has not been added to the database. |
Property | _in |
Whether the document has been inserted into the database. |
fiftyone.core.sample.Sample
Loads the document from a JSON dictionary.
The returned document will not belong to a dataset.
Returns | |
a Document |
fiftyone.core.sample.Sample
Creates a document backed by the given database document.
Parameters | |
doc | a fiftyone.core.odm.document.Document |
dataset:None | the fiftyone.core.dataset.Dataset that
the document belongs to, if any |
Returns | |
a Document |
Loads the document from a JSON string.
The returned document will not belong to a dataset.
Parameters | |
s | the JSON string |
Returns | |
a Document |
fiftyone.core.document._Document.copy
Returns a deep copy of the document that has not been added to the database.
Parameters | |
fields:None | an optional field or iterable of fields to which to restrict the copy. This can also be a dict mapping existing field names to new field names |
omitNone | an optional field or iterable of fields to exclude from the copy |
Returns | |
a Document |
fiftyone.core.sample.Sample
Reloads the document from the database.
Parameters | |
hard:False | whether to reload the document's schema in addition to its field values. This is necessary if new fields may have been added to the document schema |
fiftyone.core.frame.Frame
, fiftyone.core.sample.Sample
Reloads the backing doc from the database.
Sets the backing doc for the document.
Parameters | |
doc | a fiftyone.core.odm.document.Document |
dataset:None | the fiftyone.core.dataset.Dataset to which
the document belongs, if any |
fiftyone.core.document._Document._doc
fiftyone.core.frame.Frame
, fiftyone.core.sample.Sample
Undocumented