class Document(BaseDocument, mongoengine.Document): (source)
Known subclasses: fiftyone.core.odm.dataset.DatasetDocument
, fiftyone.core.odm.frame.DatasetFrameDocument
, fiftyone.core.odm.runs.RunDocument
, fiftyone.core.odm.sample.DatasetSampleDocument
, fiftyone.core.odm.views.SavedViewDocument
, fiftyone.core.odm.workspace.WorkspaceDocument
Constructor: Document(**kwargs)
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.
Method | __init__ |
Undocumented |
Method | copy |
Returns a deep copy of the document. |
Method | copy |
Undocumented |
Method | reload |
Reloads the document from the database. |
Method | save |
Saves the document to the database. |
Class Variable | meta |
Undocumented |
Instance Variable | id |
the ID of the document, or None if it has not been added to the database |
Instance Variable | last |
Undocumented |
Instance Variable | last |
Undocumented |
Class Method | _doc |
Undocumented |
Method | _deferred |
Undocumented |
Method | _do |
Undocumented |
Method | _insert |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _save |
Undocumented |
Method | _update |
Undocumented |
Method | _update |
Undocumented |
Method | _validate |
Undocumented |
Method | _validate |
Undocumented |
Instance Variable | _changed |
Undocumented |
Instance Variable | _created |
Undocumented |
Inherited from BaseDocument
:
Method | __eq__ |
Undocumented |
Property | in |
Whether the document has been inserted into the database. |
Method | _get |
Returns an ordered tuple of field names that should be included in the repr of the document. |
Inherited from MongoEngineBaseDocument
(via BaseDocument
):
Class Method | from |
Loads the document from a BSON/JSON dictionary. |
Method | __deepcopy__ |
Undocumented |
Method | __delattr__ |
Undocumented |
Method | __delitem__ |
Undocumented |
Method | clear |
Clears the field from the document. |
Method | field |
Undocumented |
Method | field |
Undocumented |
Method | get |
Gets the field of the document. |
Method | has |
Determines whether the document has a field of the given name. |
Method | set |
Sets the value of a field of the document. |
Method | to |
Serializes this document to a BSON/JSON dictionary. |
Property | field |
An ordered tuple of the public fields of this document. |
Method | _get |
Undocumented |
Method | _get |
Returns an ordered tuple of field names of this document. |
Method | _to |
Undocumented |
Instance Variable | _fields |
Undocumented |
Inherited from SerializableDocument
(via BaseDocument
, MongoEngineBaseDocument
):
Class Method | from |
Loads the document from a JSON string. |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | fancy |
Generates a customizable string representation of the document. |
Method | iter |
Returns an iterator over the (name, value) pairs of the public fields of the document. |
Method | merge |
Merges the contents of the given document into this document. |
Method | to |
Serializes the document to a JSON string. |
Returns a deep copy of the document.
Parameters | |
newFalse | 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 |
Reloads the document from the database.
Parameters | |
*fields | an optional args list of specific fields to reload |
**kwargs | Undocumented |
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 |
**kwargs | Undocumented |
Returns | |
self |
fiftyone.core.odm.frame.DatasetFrameDocument
, fiftyone.core.odm.sample.DatasetSampleDocument
the ID of the document, or None if it has not been added to the database
Undocumented