Querying works even for arrays and arrays in subdocuments

pull/2/head
Louis Chatriot 12 years ago
parent 342755aff2
commit e255cde1a2
  1. 12
      lib/model.js

@ -287,7 +287,10 @@ function areThingsEqual (a, b) {
}
comparisonFunctions.$lt = function (a, b) {
/**
* Check that two values are comparable
*/
function areComparable (a, b) {
if (typeof a !== 'string' && typeof a !== 'number' && !util.isDate(a) &&
typeof b !== 'string' && typeof b !== 'number' && !util.isDate(b)) {
return false;
@ -295,7 +298,12 @@ comparisonFunctions.$lt = function (a, b) {
if (typeof a !== typeof b) { return false; }
return a < b;
return true;
}
comparisonFunctions.$lt = function (a, b) {
return areComparable(a, b) && a < b;
};

Loading…
Cancel
Save