From 0cae1485b5af7392ab81d5394e7e8f016f0635aa Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Mon, 30 Apr 2018 17:11:05 -0700 Subject: [PATCH] Fix query unpacking issue with $not operator --- lib/query.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/query.coffee b/lib/query.coffee index e67923f..07739d9 100644 --- a/lib/query.coffee +++ b/lib/query.coffee @@ -149,7 +149,9 @@ expand = (query) -> conditions = permute(k, v) if conditions.length > 1 new_query['$and'] ?= [] - if v?['$ne']? + if v?['$ne']? or v?['$not']? + if Object.keys(v) > 1 + throw new Error("Cannot mix $ne or $not with other operators") for c in conditions new_query['$and'].push(c) else