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

Make findOneAnd family of methods spec compliant by default

    • 2
    • 2
    • Needed
    • Needed
    • Hide

      1. What would you like to communicate to the user about this feature?

      The default value of findOneAndDelete, findOneAndReplace, findOneAndUpdate will now return the updated/deleted document by default. If the user wants a ModifyResult returned like before, they must pass the option includeResultMetadata and set it to true. And docs examples must be updated to reflect this change from 6.0 forward.

      2. Would you like the user to see examples of the syntax and/or executable code and its output?

      Yes.

      3. Which versions of the driver/connector does this apply to?

      6.0

      Show
      1. What would you like to communicate to the user about this feature? The default value of findOneAndDelete , findOneAndReplace , findOneAndUpdate will now return the updated/deleted document by default. If the user wants a ModifyResult returned like before, they must pass the option includeResultMetadata and set it to true . And docs examples must be updated to reflect this change from 6.0 forward. 2. Would you like the user to see examples of the syntax and/or executable code and its output? Yes. 3. Which versions of the driver/connector does this apply to? 6.0

      Use Case

      As a driver engineer I want to reduce the difference between node and common driver's spec. Currently our findOneAnd* methods return a wrapped type for the findOneAnd* functions.

      User Impact

      • This will be a breaking change that will make the ok and lastErrorObject properties inaccessible.
      • ok's value is implicit by the method not throwing
      • lastErrorObject should likely convert to an error as well so there's no need to provide a way to access it.

      Dependencies

      Unknowns

      • none

      Acceptance Criteria

      Implementation Requirements

      • Make the findOneAnd functions spec compliant by default: update `includeResultMetadata` to default to false
      • make sure findOne() also returns results consistent with the other methods (i.e., null instead of undefined for both flag settings)

      Testing Requirements

      • modify spec test runner to no longer access the value property
      • update the default behavior tests
      • update any tangential tests that rely on the default behavior to access the value directly or to use the explicit flag setting

      Documentation Requirements

      • Document change in the migration guide
      • DOCSP ticket to update any documented defaults and examples

      Follow Up Requirements

      • Heads up to dev tools & mongoose

            Assignee:
            warren.james@mongodb.com Warren James
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Durran Jordan
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: