Fix alias unpacking bug in queries with $ne operator

This commit is contained in:
Zaid Abdulla committed 2016-03-04 22:01:42 +03:00
1 parent 7606d25e4b
commit 973e82cf94
1 file changed
+5 -3
+5 -3
View File
@@ -95,10 +95,12 @@ expand = (query, aliases) ->
else
conditions = permute(k, v, aliases)
if conditions.length > 1
if new_query['$and']?
new_query['$and'].push({'$or' : conditions})
new_query['$and'] ?= []
if v?['$ne']?
for c in conditions
new_query['$and'].push(c)
else
new_query['$and'] = [{'$or' : conditions}]
new_query['$and'].push({'$or' : conditions})
else
common.extend(new_query, conditions[0])