Skip to content
Myr

Merge pull request #1280 from jcomo/mongokit-doc-update

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Update mongokit pattern

authored by Markus Unterwaditzer · committed by Markus Unterwaditzer · parents 82d7c49, bd49211 · Browse files · 1 file+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−1 removed

  • other:+3 added−1 removed

1 file+3 added−1 removed

modified:docs/patterns/mongokit.rst+3 added-1 removed
46 unmodified lines
47insert query to the next without any problem. MongoKit is just schemaless48too, but implements some validation to ensure data integrity.4950Here is an example document (put this also into :file:`app.py`, e.g.)::51 from mongokit import ValidationError5253 def max_length(length):54 def validate(value):55 if len(value) <= length:56 return True56 raise Exception('%s must be at most %s characters long' % length)57 # must have %s in error format string to have mongokit place key in there58 raise ValidationError('%s must be at most {} characters long'.format(length))59 return validate6061 class User(Document):62 structure = {
81 unmodified lines