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

Support removing fields from projections #10630

Merged
merged 3 commits into from
Nov 6, 2021
Merged

Support removing fields from projections #10630

merged 3 commits into from
Nov 6, 2021

Conversation

canac
Copy link
Contributor

@canac canac commented Aug 27, 2021

Closes #10628, including new documentation.

Summary

This PR allows you to remove fields from a projection that have previously been added. query.select({ a: 1, b: 1 }).select({ b: 0 }) now produces the valid projection { a: 1 } instead of the invalid projection { a: 1, b: 0 }.

Examples

Check out the tests.

@canac canac changed the title Reduce projection Support removing fields from projections Aug 27, 2021
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

One small suggestion, looks good otherwise

lib/helpers/projection/isSubpath.js Outdated Show resolved Hide resolved
@vkarpov15 vkarpov15 changed the base branch from master to 6.1 November 6, 2021 18:45
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

Going to merge this into 6.1 branch for release with 6.1.0 👍

@vkarpov15 vkarpov15 added this to the 6.1.0 milestone Nov 6, 2021
@vkarpov15 vkarpov15 merged commit 779f5bb into Automattic:6.1 Nov 6, 2021
@canac canac deleted the reduce-projection branch November 6, 2021 20:41
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.

Allow removing fields from inclusion projection
2 participants