minor rewrite of mongoDB adapter
This commit is contained in:
@@ -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
|
||||||
|
|||||||
+4
-12
@@ -5875,23 +5875,15 @@ class MongoDBAdapter(NoSQLAdapter):
|
|||||||
|
|
||||||
# TODO This will probably not work:(
|
# TODO This will probably not work:(
|
||||||
def NOT(self, first):
|
def NOT(self, first):
|
||||||
result = {}
|
return {'$not': self.expand(first)}
|
||||||
result["$not"] = self.expand(first)
|
|
||||||
return result
|
|
||||||
|
|
||||||
def AND(self,first,second):
|
def AND(self,first,second):
|
||||||
f = self.expand(first)
|
# pymongo expects: .find({'$or': [{'name':'1'}, {'name':'2'}]})
|
||||||
s = self.expand(second)
|
return {'$and': [self.expand(first),self.expend(second)]}
|
||||||
f.update(s)
|
|
||||||
return f
|
|
||||||
|
|
||||||
def OR(self,first,second):
|
def OR(self,first,second):
|
||||||
# pymongo expects: .find({'$or': [{'name':'1'}, {'name':'2'}]})
|
# pymongo expects: .find({'$or': [{'name':'1'}, {'name':'2'}]})
|
||||||
result = {}
|
return {'$or': [self.expand(first),self.expend(second)]}
|
||||||
f = self.expand(first)
|
|
||||||
s = self.expand(second)
|
|
||||||
result['$or'] = [f,s]
|
|
||||||
return result
|
|
||||||
|
|
||||||
def BELONGS(self, first, second):
|
def BELONGS(self, first, second):
|
||||||
if isinstance(second, str):
|
if isinstance(second, str):
|
||||||
|
|||||||
Reference in New Issue
Block a user