class Human(orm.Document): _db = "test" _collection = "humans" human_id = field.AutoIncrement(collection="human") name = field.Char(required=True, min=2, max=25) age = field.Integer(required=True, min=0, max=3000) height = field.Float(min=1, max=100000) weight = field.Float(min=1, max=30000) jobs = orm.List(type=Job) genitalia = field.Char() location = Location() car = field.ModelChoice(type=Car) color = field.Choice(choices=[{ 'value': 'red', 'display': 'Red' }, { 'value': 'blue', 'display': 'Blue' }, { 'value': 'green', 'display': 'Green' }]) state = field.CollectionChoice(db='test', collection='states', sort=[('fullname', 1)]) email = field.Email()
class BadHuman(Human): unique = field.Integer() phone = field.Phone() email = field.Email(dbkey="em") car = field.ModelChoice(type=Car) active = field.Boolean() location = Loca() avatar = field.File(database=Connection().avatars)
class BadHuman(Human): unique = field.Integer() phone = field.Phone() email = field.Email(dbkey="em") car = field.ModelChoice(type=Car) active = field.Boolean() state = field.Char(validate=StateValidator) country = field.Char(validate=orm.FieldValidator) location = Loca() avatar = field.File(database=MongoClient().avatars)