Skip to content
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

feat(NODE-4924)!: remove mapReduce collection helper #3511

Conversation

baileympearson
Copy link
Contributor

@baileympearson baileympearson commented Jan 4, 2023

Description

What is changing?

Collection.mapReduce is removed.

Is there new documentation needed for these changes?

Nope.

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

@baileympearson baileympearson force-pushed the NODE-4437-remove-deprecated-options-for-v5 branch 2 times, most recently from 9c2179b to 09f2f4e Compare January 5, 2023 21:00
@baileympearson baileympearson changed the title feat: remove fullResponse property of commandoperationoptions feat(NODE-4924)!: remove mapReduce collection helper Jan 5, 2023
@baileympearson baileympearson marked this pull request as ready for review January 5, 2023 22:09
src/utils.ts Outdated
(options.out.inline === 1 || options.out === 'inline')
) {
return true;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay to remove this here? If I follow the code correctly, this method is called for all commands, including client.db().command(), so this change would also affect users who run mapReduce through that instead of the helper (and since the migration notes mention this as an alternative for cases in which users can’t use agg pipelines, that seems to be a supported use case).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a judgement call. Do you have an opinion?

When a user manually constructs the command, they can attach their own read concern. I think it's reasonable to say that because we're dropping support for mapReduce, that means we drop support for attaching readConcerns automatically when executing a runCommand.

Alternatively, we could continue to support automatically attaching the read concern to mapReduce commands. One argument in favor of this approach is that the Db.command() options does take a read concern, so users may assume that the read concern they supply as a part of the options object would get attached to their command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Db.command() options does take a read concern, so users may assume that the read concern they supply as a part of the options object would get attached to their command.

I don’t have a strong opinion, but this seems like a reasonable expectation to me, esp. if this works for other commands.

Copy link
Member

@durran durran Jan 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's reasonable to to keep it in until the driver's minimum supported server version has completely removed the command.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note as well because it seemed a bit unclear here. This is only determining if the command supports read concern - it still must be explicitly provided. This change would have just ignored the provided one in the inlined mapReduce case.

@dariakp
Copy link
Contributor

dariakp commented Jan 9, 2023

@baileympearson README changes LGTM

@baileympearson baileympearson force-pushed the NODE-4437-remove-deprecated-options-for-v5 branch from fabf2e5 to 0c6e5b5 Compare January 9, 2023 20:52
const options = { session: maybeSession(operation, context) };
if (args.out) options.out = args.out;
return collection.mapReduce(map, reduce, options);
throw new Error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mapReduce retryable-reads tests are somehow skipping so this error didn't make those tests fail, I'm not seeing it in the filter in retryable_reads.spec.test.js, any ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this threw me for a loop initially too. The filter argument in generateTopologyTests returns true for tests that run, false otherwise. The filter for the retryable reads spec test is actually an inclusion filter, not exclusion.

I added the doc comment to generateTopologyTests after getting confused by that initially.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered a minor refactor but decided not to:

  generateTopologyTests(testSuites, testContext, spec => {
    const testsToRun = [
      ... list all test regexes here
    ];
    return testsToRun.some(regex => spec.description.match(regex));
  });

want me to make the change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your call, I'm happy that we looked into it and know why they weren't run

etc/notes/CHANGES_5.0.0.md Show resolved Hide resolved
@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jan 9, 2023
etc/notes/CHANGES_5.0.0.md Outdated Show resolved Hide resolved
@nbbeeken nbbeeken added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Jan 9, 2023
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI issues, I think something caused by the merge, import related

@baileympearson baileympearson force-pushed the NODE-4437-remove-deprecated-options-for-v5 branch from 9cd3ec8 to db7bc78 Compare January 10, 2023 21:51
Co-authored-by: Neal Beeken <neal.beeken@mongodb.com>
@nbbeeken nbbeeken merged commit 10d757a into mongodb:main Jan 10, 2023
alecgibson added a commit to share/sharedb-mongo that referenced this pull request Feb 1, 2023
This is a non-breaking change that adds support for the new
[`mongodb@5`][1] driver.

Note that any consumers who use the new driver will lose access to
`$mapReduce`, since this was [removed upstream][2]. We keep this
functionality for the older drivers.

[1]: https://github.com/mongodb/node-mongodb-native/releases/tag/v5.0.0
[2]: mongodb/node-mongodb-native#3511
alecgibson added a commit to share/sharedb-mongo that referenced this pull request Feb 7, 2023
This is a non-breaking change that adds support for the new
[`mongodb@5`][1] driver.

Note that any consumers who use the new driver will lose access to
`$mapReduce`, since this was [removed upstream][2]. We keep this
functionality for the older drivers.

[1]: https://github.com/mongodb/node-mongodb-native/releases/tag/v5.0.0
[2]: mongodb/node-mongodb-native#3511
alecgibson added a commit to share/sharedb-mongo that referenced this pull request Feb 21, 2023
This is a non-breaking change that adds support for the new
[`mongodb@5`][1] driver.

Note that any consumers who use the new driver will lose access to
`$mapReduce`, since this was [removed upstream][2]. We keep this
functionality for the older drivers.

[1]: https://github.com/mongodb/node-mongodb-native/releases/tag/v5.0.0
[2]: mongodb/node-mongodb-native#3511
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants