class MyDocument(motorodm.Document): plain = motorodm.StringField() upper_case = motorodm.StringField(regex=re.compile('^[A-Z]*$'))
class Person(motorodm.Document): name = motorodm.StringField(required=True, unique=True) parent = motorodm.ReferenceField(reference_document_type=lambda: Person)
class Address(motorodm.Document): city = motorodm.StringField()
class Person(motorodm.Document): name = motorodm.StringField() address = motorodm.ReferenceField(reference_document_type=Address)
class DocA(motorodm.Document): foo = motorodm.StringField() pass