Serializers and deserializers

Functions for serialize and deserialize data.

yadm.serialize.from_mongo(document_class, data, not_loaded=(), parent=None, name=None)

Deserialize MongoDB data to document.

  • document_class – document class
  • data (dict) – data from MongoDB
  • not_loaded (list) – fields, who marked as not loaded
  • parent – parent for new document
  • name (str) – name for new document
yadm.serialize.to_mongo(document, exclude=(), include=None)

Serialize document to MongoDB data.

  • document (BaseDocument) – document for serializing
  • exclude (list) – exclude fields
  • include (list) – include only fields (all by default)