class NamedRestKeyCollection(models.DataFileCollection): config_collection_name = 'adsdata_test' foo = fields.StringField(_id=True) bar = fields.IntField() baz = fields.ListField(fields.StringField()) restkey = 'baz' field_order = [foo, bar]
class Match(DocumentBase): domains = fields.ListField(fields.StringField()) keywords = fields.ListField(fields.StringField()) def to_dict(self): return { 'domains': self.domains, 'keywords': self.keywords, }
class AggregatedCollection(models.DataFileCollection): config_collection_name = 'adsdata_test' foo = fields.StringField(_id=True) bar = fields.ListField(fields.StringField()) aggregated = True field_order = [foo, bar] @classmethod def post_load_data(cls, *args, **kwargs): pass
class Namespace(DocumentBase): name = fields.StringField() modified = fields.DateTimeField() interests = fields.ListField(fields.DocumentField(Interest)) removed = fields.BoolField(default=False) def __unicode__(self): return u'<Namespace: %s>' % self.name
class Interest(DocumentBase): name = fields.StringField() modified = fields.DateTimeField() current = fields.DocumentField(InterestVersion) versions = fields.ListField(fields.DocumentField(InterestVersion)) def to_dict(self): if self.current: return self.current.to_dict() return None
class BasicCollection(models.DataFileCollection): config_collection_name = 'adsdata_test' foo = fields.StringField(_id=True) bar = fields.IntField() field_order = [foo, bar]
class CoerceCollection2(models.DataFileCollection): foo = fields.FloatField() bar = fields.ListField(fields.StringField())
class CoerceCollection(models.DataFileCollection): foo = fields.StringField() bar = fields.IntField()