|
|
@ -2557,7 +2557,7 @@ function areThingsEqual (a, b) { |
|
|
|
|
|
|
|
|
|
|
|
// Arrays (no match since arrays are used as a $in)
|
|
|
|
// 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)
|
|
|
|
// 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)
|
|
|
|
// General objects (check for deep equality)
|
|
|
|
// a and b should be objects at this point
|
|
|
|
// a and b should be objects at this point
|
|
|
@ -2776,6 +2776,11 @@ function matchQueryPart (obj, queryKey, queryValue, treatObjAsValue) { |
|
|
|
|
|
|
|
|
|
|
|
// Check if the value is an array if we don't force a treatment as value
|
|
|
|
// Check if the value is an array if we don't force a treatment as value
|
|
|
|
if (util.isArray(objValue) && !treatObjAsValue) { |
|
|
|
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
|
|
|
|
// Check if we are using an array-specific comparison function
|
|
|
|
if (queryValue !== null && typeof queryValue === 'object' && !util.isRegExp(queryValue)) { |
|
|
|
if (queryValue !== null && typeof queryValue === 'object' && !util.isRegExp(queryValue)) { |
|
|
|
keys = Object.keys(queryValue); |
|
|
|
keys = Object.keys(queryValue); |
|
|
@ -2793,7 +2798,7 @@ function matchQueryPart (obj, queryKey, queryValue, treatObjAsValue) { |
|
|
|
|
|
|
|
|
|
|
|
// queryValue is an actual object. Determine whether it contains comparison operators
|
|
|
|
// queryValue is an actual object. Determine whether it contains comparison operators
|
|
|
|
// or only normal fields. Mixed objects are not allowed
|
|
|
|
// 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); |
|
|
|
keys = Object.keys(queryValue); |
|
|
|
firstChars = _.map(keys, function (item) { return item[0]; }); |
|
|
|
firstChars = _.map(keys, function (item) { return item[0]; }); |
|
|
|
dollarFirstChars = _.filter(firstChars, function (c) { return c === '$'; }); |
|
|
|
dollarFirstChars = _.filter(firstChars, function (c) { return c === '$'; }); |
|
|
|