Skip to content

feat(NODE-4184): do not throw with explain and write conceern #4582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

durran
Copy link
Member

@durran durran commented Jul 13, 2025

Description

The driver will no longer throw an error if aggregate is used with explain and write concern. The server simply ignores the write concern in this case.

What is changing?

  • Removes the check and throw from the aggregation operation.
  • Adds a unit test to protect from regressions.
Is there new documentation needed for these changes?

None

What is the motivation for this change?

NODE-4184

Release Highlight

Explain + Write Concern on an aggregation no longer throws.

The server will silently ignore the write concern.

// Previously this would throw a MongoInvalidArgumentError, now it will return explain results.
collection.aggregate([{ $match: { n: 1 }}], { writeConcern: { w: 1 }, explain: 'verbose' });

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@durran durran closed this Jul 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant