|
|
|
@ -489,7 +489,7 @@ function areThingsEqual (a, b) { |
|
|
|
|
|
|
|
|
|
// Arrays (no match since arrays are used as a $in)
|
|
|
|
|
// undefined (no match since they mean field doesn't exist and can't be serialized)
|
|
|
|
|
if (util.isArray(a) || util.isArray(b) || a === undefined || b === undefined) { return false; } |
|
|
|
|
if ((!(util.isArray(a) && util.isArray(b)) && (util.isArray(a) || util.isArray(b))) || a === undefined || b === undefined) { return false; } |
|
|
|
|
|
|
|
|
|
// General objects (check for deep equality)
|
|
|
|
|
// a and b should be objects at this point
|
|
|
|
@ -708,6 +708,11 @@ function matchQueryPart (obj, queryKey, queryValue, treatObjAsValue) { |
|
|
|
|
|
|
|
|
|
// Check if the value is an array if we don't force a treatment as value
|
|
|
|
|
if (util.isArray(objValue) && !treatObjAsValue) { |
|
|
|
|
// If the queryValue is an array, try to perform an exact match
|
|
|
|
|
if (util.isArray(queryValue)) { |
|
|
|
|
return matchQueryPart(obj, queryKey, queryValue, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Check if we are using an array-specific comparison function
|
|
|
|
|
if (queryValue !== null && typeof queryValue === 'object' && !util.isRegExp(queryValue)) { |
|
|
|
|
keys = Object.keys(queryValue); |
|
|
|
@ -725,7 +730,7 @@ function matchQueryPart (obj, queryKey, queryValue, treatObjAsValue) { |
|
|
|
|
|
|
|
|
|
// queryValue is an actual object. Determine whether it contains comparison operators
|
|
|
|
|
// or only normal fields. Mixed objects are not allowed
|
|
|
|
|
if (queryValue !== null && typeof queryValue === 'object' && !util.isRegExp(queryValue)) { |
|
|
|
|
if (queryValue !== null && typeof queryValue === 'object' && !util.isRegExp(queryValue) && !util.isArray(queryValue)) { |
|
|
|
|
keys = Object.keys(queryValue); |
|
|
|
|
firstChars = _.map(keys, function (item) { return item[0]; }); |
|
|
|
|
dollarFirstChars = _.filter(firstChars, function (c) { return c === '$'; }); |
|
|
|
|