Make sure operator/options are honored

This commit is contained in:
Raymond Feng 2015-07-02 11:27:33 -07:00
parent 50ac143cea
commit 542afefb1d
1 changed files with 6 additions and 1 deletions

View File

@ -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;