-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
|
||
// $ExpectType Cursor<{ name: string; }> | ||
typedCollection.find().project<{ name: string }>({ name: 1 }); | ||
expectType<FindCursor<{ name: string }>>(typedCollection.find().project({ name: 1 })); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.