|
@@ -140,8 +140,9 @@ klass.cmp = function cmp(l, r){
|
|
|
**/
|
|
**/
|
|
|
var Document; // loaded lazily below //TODO: a dirty hack; need to investigate and clean up
|
|
var Document; // loaded lazily below //TODO: a dirty hack; need to investigate and clean up
|
|
|
klass.compare = function compare(l, r) {
|
|
klass.compare = function compare(l, r) {
|
|
|
- var lt = typeof(l),
|
|
|
|
|
- rt = typeof(r),
|
|
|
|
|
|
|
+ //NOTE: deviation from mongo code: we have to do some coercing for null "types" because of javascript
|
|
|
|
|
+ var lt = l === null ? "null" : typeof(l),
|
|
|
|
|
+ rt = r === null ? "null" : typeof(r),
|
|
|
ret;
|
|
ret;
|
|
|
|
|
|
|
|
// 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
|
|
// 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
|