aboutsummaryrefslogtreecommitdiff
path: root/mongodb.py
diff options
context:
space:
mode:
Diffstat (limited to 'mongodb.py')
-rw-r--r--mongodb.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mongodb.py b/mongodb.py
index 991ed62b..2da229c8 100644
--- a/mongodb.py
+++ b/mongodb.py
@@ -64,14 +64,17 @@ class Articles(object):
collection = self.db[str(feed_id)]
return collection.find({"article_id":article_id}).next()
- def get_all_collections(self):
+ def get_all_collections(self, condition=None):
"""
"""
feeds = []
collections = self.db.collection_names()
for collection_name in collections:
if collection_name != "system.indexes":
- cursor = self.db[collection_name].find({"type":0})
+ if condition is None:
+ cursor = self.db[collection_name].find({"type":0})
+ else:
+ cursor = self.db[collection_name].find({"type":0, condition[0]:condition[1]})
if cursor.count() != 0:
feeds.append(cursor.next())
feeds = sorted(feeds, key=itemgetter('feed_title'))
bgstack15