Пример #1
0
class Beacon(orm.Document):
    _db = 'lablog'
    _collection = 'floorplan_beacons'

    id = field.Char()
    x = field.Integer()
    y = field.Integer()
    level = field.Integer()
    location = field.DocumentId(type=Location)
Пример #2
0
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()
Пример #3
0
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)
Пример #4
0
class Human(orm.Document):
    _db = "test"
    _collection = "humans"
    name = field.Char(required=True, min=2, max=25)
    age = field.Integer(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()
Пример #5
0
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)
Пример #6
0
class PhilipsHue(Interface):
    exchange = messages.Exchanges.node
    measurement_key = 'actuator.light'

    bridge_id = field.Char()
    access_token = field.Char()
    light_id = field.Integer()

    def data(self, data=None): pass

    def parse_data(self, data): pass
Пример #7
0
class Newsfeed(orm.Document):
    """docstring for Newsfeed"""
    _db = dbName
    _collection = collectionName
    guid = field.Char(required=True)
    # rss_id = field.AutoIncrement(collection="newsfeeds")
    title = field.Char(required=True)
    descript = field.Char(required=True)
    link = field.Char(required=True)
    piclink = field.Char()
    # date = field.TimeStamp(required=True)
    source = field.Char()
    # category = field.Char(required=True)
    tags = field.Char()
    #Editor Related fields
    #0:Unviewed, 1:edited, 2:dismissed, 3:editLater
    editStatus = field.Integer(required=True, min=0, max=3)
    editorId = field.Integer(required=True)
    editorMemo = field.Char()
    editorDate = field.TimeStamp()
Пример #8
0
class Feature(orm.Document):
    """
    Feature class
    """
    _db = "os_mongo"
    _collection = "features"
    feature_id = field.AutoIncrement(collection="experiment")
    experiment_id = field.Integer(required=True)
    mass = field.Float(required=True)
    rt = field.Float(required=True)
    abundances = orm.List(type=Abundance)
    main_attribution = field.Char()
    annotations = orm.List(type=Annotation)
Пример #9
0
class Human(orm.Document):
    _db = "test"
    _collection = "humans"
    _indexes = [
        orm.Index("name", key=[("name", orm.Index.DESCENDING)]), 
        orm.Index("human_id", key=[("human_id", orm.Index.ASCENDING)]),
        orm.Index("geo_location", key=[("jobs.locations.geo", orm.Index.GEO2D)])
    ]
    human_id = field.AutoIncrement(collection="human")
    name = field.Char(required=True, min=2, max=25)
    age = field.Integer(min=0, max=3000)
    height = field.Float(min=1, max=100000)
    weight = field.Float(min=1)
    jobs = orm.List(type=Job, length=3)
    genitalia = field.Char()
Пример #10
0
class TriggerInstance(orm.Document):
    _db = "lablog"
    _collection = "trigger_instance"

    _indexes = [
        orm.Index('interface', key=('interface', 1), unique=True),
        orm.Index('trigger', key=('trigger.id', 1)),
        orm.Index('enabled', key=('enabled', 1)),
        orm.Index('key', key=('key', 1)),
    ]

    enabled = field.Boolean(default=True)
    interface = field.Char()
    level = field.Integer()
    key = field.Char()
Пример #11
0
class SNMP(Interface):

    mibs = field.Char()
    ip = field.Char()
    community = field.Char()
    version = field.Integer()
Пример #12
0
class UserStats(mongodb.EmbeddedDocument):
    total_wins = field.Integer(min=0, max=10000000, default=0)
    total_games = field.Integer(min=0, max=10000000, default=0)
    total_loops = field.Integer(min=0, max=10000000, default=0)