aboutsummaryrefslogtreecommitdiff
path: root/mongodb.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2012-03-20 21:21:49 +0100
committercedricbonhomme <devnull@localhost>2012-03-20 21:21:49 +0100
commit70bdfda0dcb371973a5929bc9bc50593154867a6 (patch)
tree730ad2913aa68111a6fd1a5cde23c593711edb2a /mongodb.py
parentRemoved articles.py. (diff)
downloadnewspipe-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.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/mongodb.py b/mongodb.py
index a37b80c0..d00b453e 100644
--- a/mongodb.py
+++ b/mongodb.py
@@ -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):
"""
bgstack15