Exemplo n.º 1
0
class Movies(mongo.Document):
    meta = {'strict': False}
    projections = [
        '_id', 'budget', 'homepage', 'imdb_id', 'original_title', 'overview',
        'release_date', 'runtime', 'tagline'
    ]

    _id = mongo.ObjectIdField()
    original_title = mongo.StringField()
    overview = mongo.StringField()
    tagline = mongo.StringField()
    runtime = mongo.IntField()
    budget = mongo.IntField()
    homepage = mongo.StringField()
    release_date = mongo.DateTimeField()

    def __repr__(self):
        return '{} - id: {}: {}'.format(str(self.__class__), self._id,
                                        self.original_title)

    @classmethod
    def search(cls, query, page, per_page):
        ids, total = query_index(query, page, per_page)
        if total == 0:
            return [], 0
        movies = Movies.objects(_id__in=ids)
        return movies, total
Exemplo n.º 2
0
class Employer(mongo.Document):
    company_name = mongo.StringField()
    description = mongo.StringField()
    num_employees = mongo.IntField()
    username = mongo.StringField()
    email = mongo.StringField()
    password = mongo.StringField()
    location = mongo.StringField()
Exemplo n.º 3
0
class Article(mongo.Document):
    id = mongo.IntField(unique=True)
    ArtName = mongo.StringField()
    ArtSingleInfo = mongo.StringField(max_langth=100)
    ArtAllInfo = mongo.StringField()
    FirstDevide = mongo.StringField()
    SecondDevide = mongo.StringField()
    images = mongo.StringField()
    Source = mongo.FileField()
Exemplo n.º 4
0
class Review(mongo.EmbeddedDocument):

    review = mongo.StringField(required=True)
    num_users = mongo.IntField(default=0, required=True)
Exemplo n.º 5
0
class Sentiment(mongo.EmbeddedDocument):
    about = mongo.StringField(required=True)
    positive = mongo.IntField(default=0, required=True)
    neutral = mongo.IntField(default=0, required=True)
    negative = mongo.IntField(default=0, required=True)