AggregateOperation should not throw when explain + writeConcern is specified

XMLWordPrintableJSON

    • 2
    • 2
    • None
    • Hide

      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.

      Show
      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      User Story

      As an application developer

      I do not want the driver to throw an error when I explain an aggregation with a writeConcern

      So I can get the correct server response with the queryPlanner results.

      Use Case

      The AggregateOperation constructor has logic to throw an error if an aggregation is constructed with explain and writeConcern set (https://github.com/mongodb/node-mongodb-native/blob/5b3d01b824587dfa75f36ef9e55f6559d5fc5fe9/src/operations/aggregate.ts#L71).  Instead, the node driver should not throw an error and rely on the server response, which ignores the option.

      User Impact

      The server does not error in this case so user catch blocks will just become dead code.

      Dependencies

      Unknowns

      • None.

      Acceptance Criteria

      Implementation Requirements

      • Remove the writeConcern check and throwing of the MongoInvalidArgumentError

      Testing Requirements

      • Change any tests asserting this throws to asseting an explain result is returned. If none exist then add a new test to avoid regressions.

      Documentation Requirements

      • Note in the release notes that this scenario will no longer throw and will return the correct results from the server.

      Follow Up Requirements

      • n/a

              Assignee:
              Unassigned
              Reporter:
              Bailey Pearson
              None
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated: