validator – Validate the document

class monguo.validator.Validator(document_cls, collection)

Validate the document before insert(), update() and save().

insert(doc_or_docs, **kwargs)

Validate when call Document.insert().

  • doc_or_docs: The doc or docs to be inserted.
  • **kwargs: see insert()
save(to_save, **kwargs)

Validate when call

  • to_save: The doc or docs to be saved.
  • **kwargs: see save()
update(spec, document, upsert=False, **kwargs)

Validate when call Document.update().

  • spec: The query condition.
  • document: The content to be updated.
  • upsert: Perform an upsert if True. It only support $setOnInsert in monguo.
  • **kwargs: see update()
Fork me on GitHub