-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 5.1.0-rc3
-
Component/s: None
-
Fully Compatible
-
ALL
-
The tests in expression_trigonometric.js use assert.lt (in here) to compare the array of results returned from the aggregation pipeline with an array created in JavaScript. Then, the implementation of assert.lt (in here) uses the < JavaScript operator to perform the less-than comparison. As JavaScript does not provide operator overloading, to perform the comparison between arrays or objects, calls toString on them and compares the results. For objects, toString always returns "[object Object]" for JavaScript-created objects and "[object BSON]" for BSON objects (usually returned from an aggregation pipeline). Then, the comparison here always returns true irrespective of the values, as long as a value exists.
This is just one instance and we should keep an eye for other tests that might suffer from the same incorrect usage of JavaScript comparison operators.