Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-891

breaking change in 2 mongodb driver after patch update

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.14
    • Affects Version/s: 2.2.13
    • Component/s: None
    • Environment:
      nodejs 6.9.1

      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 = [

      { a : 1 } { b : 1 }

      ]

      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'

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            services@feeld.co Adrian Gierakowski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: