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

fix(NODE-3343): allow overriding result document after projection applied #2856

Merged
merged 4 commits into from
Jun 25, 2021

Conversation

nbbeeken
Copy link
Contributor

This allows for users to override the resulting documents after a projection is applied.
A furhter improvement could be to use the projection to filter the keys out of the schema but that requires the projection to be a const type. I leave that up to a future feature request.

@dariakp dariakp added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jun 24, 2021
@dariakp dariakp self-requested a review June 24, 2021 19:54

// $ExpectType Cursor<{ name: string; }>
typedCollection.find().project<{ name: string }>({ name: 1 });
expectType<FindCursor<{ name: string }>>(typedCollection.find().project({ name: 1 }));
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way to add at least one expectNotType test here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also it looks like a number of assertions are failing in the pipeline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added two! pipeline should be clear, of course clarity is key so let me know if there's more I can add to cover more use cases.

Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

LGTM

@dariakp dariakp marked this pull request as ready for review June 24, 2021 21:05
@dariakp dariakp added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Jun 24, 2021
@dariakp dariakp requested review from emadum and durran June 24, 2021 21:10
@dariakp dariakp merged commit 988f9c8 into 4.0 Jun 25, 2021
@dariakp dariakp deleted the NODE-3343/projection branch June 25, 2021 15:20
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