Null and 0 comparison should probably not evaluate to true
The snippet below works as expected.
data.where('result.score.raw > 0').orderBy('result.score.raw');
data.where('result.score.raw >= 0 and result.score.raw != null').orderBy('result.score.raw');
However this:
data.where('result.score.raw >= 0').orderBy('result.score.raw');
Results in:
xapicollection.js:698 Uncaught TypeError: Cannot read property 'toLowerCase' of null.
Which leads me to believe that the Collection class evaluates 0 == null to true and includes statements with null (or undefined?) score values in the resultant collection. This should probably not happen.
null >= 0
true
Upstream "bug" with ECMA 5. Maybe we could implement some >== that checks types?
Yes. That's a very, very good idea.
I will file a number of issues with ECMA 5. Enough is enough.
Since this hasn't been touched in awhile, just making note here that maybe a workaround could be adding typeof getVal(parse.xpath.stmt) === typeof parse.value && to lines 470 and 471 in xapicollection.js