class User(Document): __collection__ = "AggregationUser" email = StringField(required=True) first_name = StringField(max_length=50, default=lambda: "Bernardo") last_name = StringField(max_length=50, default="Heynemann") is_admin = BooleanField(default=True) updated_at = DateTimeField(required=True, auto_now_on_insert=True, auto_now_on_update=True) number_of_documents = IntField() list_items = ListField(IntField())
class User(Document): email = StringField(required=True) first_name = StringField(max_length=50, default=lambda: "Bernardo") last_name = StringField(max_length=50, default="Heynemann") is_admin = BooleanField(default=True) website = URLField(default="http://google.com/") updated_at = DateTimeField(required=True, auto_now_on_insert=True, auto_now_on_update=True) facebook_id = StringField(unique=True, sparse=True) def __repr__(self): return "%s %s <%s>" % (self.first_name, self.last_name, self.email)
class User(Document): email = StringField(required=True) first_name = StringField(db_field="whatever", max_length=50, default=lambda: "Bernardo") last_name = StringField(max_length=50, default="Heynemann") is_admin = BooleanField(default=True) website = URLField(default="http://google.com/") updated_at = DateTimeField(required=True, auto_now_on_insert=True, auto_now_on_update=True) embedded = EmbeddedDocumentField(EmbeddedDocument, db_field="embedded_document") nullable = EmbeddedDocumentField(EmbeddedDocument, db_field="nullable_embedded_document") numbers = ListField(IntField()) def __repr__(self): return "%s %s <%s>" % (self.first_name, self.last_name, self.email)
class Child(Document): __collection__ = "InOperatorTest" dt = DateTimeField()
class Model(Document): created = DateTimeField(auto_now_on_insert=True, auto_now_on_update=True)