Example #1
0
def posts_from_date(date):
    d_end = date + datetime.timedelta(days=1)
    return posts.find({
        'created_time': {
            "$gt": date,
            "$lt": d_end
        }
    }).sort('shares', pymongo.DESCENDING)
Example #2
0
def search_text_in_db(s):
    """
    search text in db and return matched documents(posts)


    :return: return list of posts that match the text query.
    """
    return posts.find({'$text': {'$search': s}})
Example #3
0
def search_text_in_db(s):
    """
    search text in db and return matched documents(posts)


    :return: return list of posts that match the text query.
    """
    return posts.find({'$text': {'$search': s}})
Example #4
0
def get_recent_posts(limit=50):
    return posts.find().sort('created_time', pymongo.DESCENDING).limit(limit)
Example #5
0
def get_posts_ordered_by_score(the_page_id, limit=50):
    return posts.find({
        'page_id': the_page_id
    }).sort('shares', pymongo.DESCENDING).limit(limit)
Example #6
0
def get_posts_ordered_by_popularity(the_page_id):
    return posts.find({
        'page_id': the_page_id
    }).sort('shares', pymongo.DESCENDING)
Example #7
0
def get_recent_posts(limit=50):
    return posts.find().sort('created_time', pymongo.DESCENDING).limit(limit)
Example #8
0
def get_posts_ordered_by_score(the_page_id, limit=50):
    return posts.find({'page_id': the_page_id}).sort('shares', pymongo.DESCENDING).limit(limit)
Example #9
0
def get_posts_ordered_by_popularity(the_page_id):
    return posts.find({'page_id': the_page_id}).sort('shares', pymongo.DESCENDING)
Example #10
0
def posts_from_date(date):
    d_end = date + datetime.timedelta(days=1)
    return posts.find({'created_time': {"$gt": date, "$lt": d_end}}).sort('shares', pymongo.DESCENDING)