From c7cf13f8ea358f1b6bf4ce0358d0162bc7a89d9b Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sat, 16 Nov 2013 03:39:39 -0600 Subject: [PATCH] minor rewrite of mongoDB adapter --- VERSION | 2 +- gluon/dal.py | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/VERSION b/VERSION index 478b2c89..cfe35b9b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.7.4-stable+timestamp.2013.11.16.03.31.47 +Version 2.7.4-stable+timestamp.2013.11.16.03.38.41 diff --git a/gluon/dal.py b/gluon/dal.py index eb260254..2f58291e 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -5875,23 +5875,15 @@ class MongoDBAdapter(NoSQLAdapter): # TODO This will probably not work:( def NOT(self, first): - result = {} - result["$not"] = self.expand(first) - return result + return {'$not': self.expand(first)} def AND(self,first,second): - f = self.expand(first) - s = self.expand(second) - f.update(s) - return f + # pymongo expects: .find({'$or': [{'name':'1'}, {'name':'2'}]}) + return {'$and': [self.expand(first),self.expend(second)]} def OR(self,first,second): # pymongo expects: .find({'$or': [{'name':'1'}, {'name':'2'}]}) - result = {} - f = self.expand(first) - s = self.expand(second) - result['$or'] = [f,s] - return result + return {'$or': [self.expand(first),self.expend(second)]} def BELONGS(self, first, second): if isinstance(second, str):