-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.2.13
-
Component/s: None
-
Environment:nodejs 6.9.1
-
Empty show more show less
Recent minor version update introduced a breaking change: queries which contain properties which value is 'undefined' cause an error: MongoError "cannot compare to undefined"
previously undefined was treated the same was as null ( for as long as I can remember )
I understand that previous behaviour might have been an unintended feature, however the introduced fix, changes behaviour in a way that will definitely break many applications.
here's a coffeescript example of code which used to work in versions < 2.2.13, and which now throws:
```
docs = [
]
db.events.insert docs
.then ->
Promise.all [
db.events.findOne a : undefined
db.events.findOne a : null
]
.then ( [ result_for_undefined, result_for_null ] ) ->
console.log result_for_undefined._id.equals result_for_null._id
```
the call to console.log would print 'true'