Browse Source

Refs #3836. Fixed bug in Value.compare

Spencer Rathbun 12 years ago
parent
commit
f9077b85c6
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lib/pipeline/Value.js

+ 2 - 2
lib/pipeline/Value.js

@@ -144,8 +144,8 @@ klass.compare = function compare(l, r) {
 		rt = typeof(r),
 		ret;
 
-	if (lt == rt) ret = 0;
-	else ret = (klass.cmp(klass.canonicalize(l), klass.canonicalize(r)));
+	// NOTE: deviation from mongo code: javascript types do not work quite the same, so for proper results we always canonicalize, and we don't need the "speed" hack
+	ret = (klass.cmp(klass.canonicalize(l), klass.canonicalize(r)));
 
 	if(ret !== 0) return ret;