Fix alias unpacking bug in queries with $ne operator

This commit is contained in:
Zaid Abdulla committed 2016-03-07 02:45:43 +03:00
1 parent 650efa9bec
commit 4e57b7124a
1 file changed
+5 -3
+5 -3
View File
@@ -95,10 +95,12 @@ expand = (query, aliases) ->
else else
conditions = permute(k, v, aliases) conditions = permute(k, v, aliases)
if conditions.length > 1 if conditions.length > 1
if new_query['$and']? new_query['$and'] ?= []
new_query['$and'].push({'$or' : conditions}) if v?['$ne']?
for c in conditions
new_query['$and'].push(c)
else else
new_query['$and'] = [{'$or' : conditions}] new_query['$and'].push({'$or' : conditions})
else else
common.extend(new_query, conditions[0]) common.extend(new_query, conditions[0])