class documentation

Mixin for all mongoengine:mongoengine.base.BaseDocument subclasses that implements the SerializableDocument interface.

Class Method from_dict Loads the document from a BSON/JSON dictionary.
Method __deepcopy__ Undocumented
Method __delattr__ Undocumented
Method __delitem__ Undocumented
Method clear_field Clears the field from the document.
Method field_to_mongo Undocumented
Method field_to_python Undocumented
Method get_field Gets the field of the document.
Method has_field Determines whether the document has a field of the given name.
Method set_field Sets the value of a field of the document.
Method to_dict Serializes this document to a BSON/JSON dictionary.
Property field_names An ordered tuple of the public fields of this document.
Method _get_field Undocumented
Method _get_field_names Returns an ordered tuple of field names of this document.
Method _get_repr_fields Returns an ordered tuple of field names that should be included in the repr of the document.
Method _to_db_fields Undocumented
Instance Variable _fields_ordered Undocumented

Inherited from SerializableDocument:

Class Method from_json Loads the document from a JSON string.
Method __eq__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method copy Returns a deep copy of the document.
Method fancy_repr Generates a customizable string representation of the document.
Method iter_fields 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_json Serializes the document to a JSON string.
@classmethod
def from_dict(cls, d, extended=False): (source)

Loads the document from a BSON/JSON dictionary.

Parameters
da dictionary
extended:Falsewhether the input dictionary may contain serialized extended JSON constructs
Returns
a SerializableDocument
def __deepcopy__(self, memo): (source)

Undocumented

def __delattr__(self, name): (source)

Undocumented

def __delitem__(self, name): (source)

Undocumented

def clear_field(self, field_name): (source)

Clears the field from the document.

Parameters
field_namethe field name
Raises
ValueErrorif the field does not exist
def field_to_mongo(self, field_name): (source)

Undocumented

def field_to_python(self, field_name, value): (source)

Undocumented

def get_field(self, field_name): (source)

Gets the field of the document.

Parameters
field_namethe field name
Returns
the field value
Raises
AttributeErrorif the field does not exist
def has_field(self, field_name): (source)

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

Parameters
field_namethe field name
Returns
True/False
def set_field(self, field_name, value, create=True): (source)

Sets the value of a field of the document.

Parameters
field_namethe field name
valuethe field value
create:Truewhether to create the field if it does not exist
Raises
ValueErrorif field_name is not an allowed field name or does not exist and create == False
def to_dict(self, extended=False): (source)

Serializes this document to a BSON/JSON dictionary.

Parameters
extended:Falsewhether to serialize extended JSON constructs such as ObjectIDs, Binary, etc. into JSON format
Returns
a dict
@property
field_names = (source)

An ordered tuple of the public fields of this document.

def _get_field(self, field_name, allow_missing=False): (source)
def _get_field_names(self, include_private=False, use_db_fields=False): (source)

Returns an ordered tuple of field names of this document.

Parameters
include_private:Falsewhether to include private fields
use_db_fields:Falsewhether to return database fields
Returns
a tuple of field names
def _get_repr_fields(self): (source)

Returns an ordered tuple of field names that should be included in the repr of the document.

Returns
a tuple of field names
def _to_db_fields(self, field_names): (source)

Undocumented

_fields_ordered = (source)

Undocumented