diff options
author | cedricbonhomme <devnull@localhost> | 2012-03-20 21:21:49 +0100 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2012-03-20 21:21:49 +0100 |
commit | 70bdfda0dcb371973a5929bc9bc50593154867a6 (patch) | |
tree | 730ad2913aa68111a6fd1a5cde23c593711edb2a /mongodb.py | |
parent | Removed articles.py. (diff) | |
download | newspipe-70bdfda0dcb371973a5929bc9bc50593154867a6.tar.gz newspipe-70bdfda0dcb371973a5929bc9bc50593154867a6.tar.bz2 newspipe-70bdfda0dcb371973a5929bc9bc50593154867a6.zip |
MongoDB collection of articles is indexed with 'article_date'.
Diffstat (limited to 'mongodb.py')
-rw-r--r-- | mongodb.py | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -37,7 +37,7 @@ class Articles(object): """ collection = self.db[str(feed_id)] - collection.create_index([("article_link", pymongo.ASCENDING), ("article_date", pymongo.DESCENDING)], \ + collection.create_index([("article_date", pymongo.DESCENDING)], \ {"unique":False, "sparse":False}) for article in articles: @@ -105,8 +105,7 @@ class Articles(object): cursor = collection.find({"type":1}) else: cursor = collection.find({"type":1, condition[0]:condition[1]}) - #return cursor.sort([("article_date", pymongo.DESCENDING)]) - return cursor + return cursor.sort([("article_date", pymongo.DESCENDING)]) def print_articles_from_collection(self, collection_id): """ |