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

Clarify documentation how promoteValues and other BSON settings effect results and errors from driver

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.3
    • Component/s: None
    • None

      It seems that when promoteValues: false is specified for an operation the error codes are also returned as BSON objects:

      Without promoteValues: false:

      coll.aggregate([{}]).toArray().catch(err => err.code)
      40323
      

      With promoteValues: false:

      coll.aggregate([{}], {promoteValues: false}).toArray().catch(err => err.code)
      Int32 { _bsontype: 'Int32', value: 40323 }
      

      Couldn't find anything about this in our docs or spec, but I would expect the error code to stay a number regardless of how the method is invoked.

      ------
      Related note captured from NODE-3123: The behavior of the driver related to the promoteValues is currently not very well documented, and should be improved (see NODE-3222).

            Assignee:
            Unassigned Unassigned
            Reporter:
            maurizio.casimirri@mongodb.com Maurizio Casimirri
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: