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

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.6.3
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • 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
            Reporter:
            Maurizio Casimirri
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: