Example #1
0
class Thread(Queryable):
    __collection__ = 'threads'

    class Flags(Document):
        locked = Boolean()
        sticky = Boolean()
        hidden = Boolean()
        uploads = Boolean()

    class Comment(Identified, Reply):
        class Votes(Document):
            count = Integer()
            who = Array(ObjectId())

        id = ObjectId('_id')
        message = String()
        vote = Embed(Votes)
        creator = ObjectId()
        updated = Date(default=utcnow, assign=True)
        uploads = Array(ObjectId())  # GridFS file references.

    class Continuation(Reply):
        continued = Reference()

    title = String()
    forum = Reference()

    replies = Array(Embed(Reply))

    flag = Embed(Flags)
    stat = Embed(Statistics)

    subscribers = Array(ObjectId())
    updated = Date(default=utcnow, assign=True)
Example #2
0
class Sample(Document):
    class Embedded(Document):
        name = String()

    generic = Field()
    field = String('field_name')
    number = Number('field_name', default=27)
    array = Array(Number(default=42), name='field_name')
    embed = Embed(Embedded)
Example #3
0
class Account(Queryable):
	__collection__ = 'collection'
	
	username = String(required=True)
	name = String()
	locale = String(default='en-CA-u-tz-cator-cu-CAD', assign=True)
	age = Number()
	
	tag = Array(String(), assign=True)
	
	_username = Index('username', unique=True)
Example #4
0
    class Comment(Identified, Reply):
        class Votes(Document):
            count = Integer()
            who = Array(ObjectId())

        id = ObjectId('_id')
        message = String()
        vote = Embed(Votes)
        creator = ObjectId()
        updated = Date(default=utcnow, assign=True)
        uploads = Array(ObjectId())  # GridFS file references.
Example #5
0
		class Sample(Document):
			field = Field()
			number = Number()
			array = Array()
Example #6
0
 class Votes(Document):
     count = Integer()
     who = Array(ObjectId())
Example #7
0
class Person(Queryable):
    __collection__ = 'people'

    name = String()
    tag = Array(String())
Example #8
0
 class Sample(Document):
     field = String()
     number = Number('other')
     array = Array(String())
Example #9
0
 class Sample(Document):
     field = Array(String())
     alias = Alias('field.0')
Example #10
0
    class Sample(Document):
        class Embedded(Document):
            field = String()

        field = Array(Embedded)
        alias = Alias('field.0.field')
Example #11
0
 class Arrays(Document):
     foo = Array(String())
     bar = Array(String())