From 542afefb1d964a6baa830ad00cee9b324be4861b Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Thu, 2 Jul 2015 11:27:33 -0700 Subject: [PATCH] Make sure operator/options are honored --- lib/dao.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/dao.js b/lib/dao.js index 36018285..61d083ba 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -1139,6 +1139,7 @@ DataAccessObject._coerce = function (where) { } // Check there is an operator var operator = null; + var exp = val; if (val.constructor === Object) { for (var op in operators) { if (op in val) { @@ -1172,7 +1173,7 @@ DataAccessObject._coerce = function (where) { break; } } - } + } else // Coerce the array items if (Array.isArray(val)) { for (var i = 0; i < val.length; i++) { @@ -1189,6 +1190,10 @@ DataAccessObject._coerce = function (where) { if (operator) { var value = {}; value[operator] = val; + if (exp.options) { + // Keep options for operators + value.options = exp.options; + } val = value; } where[p] = val;