Parcourir la source

Refs #3836. Fixed bug in Value.compare

Spencer Rathbun il y a 12 ans
Parent
commit
12ff66872a
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  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;