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

select method is not removing __t field -__t #13679

Closed
2 tasks done
cg-julian-taylor opened this issue Aug 1, 2023 · 0 comments · Fixed by #13722
Closed
2 tasks done

select method is not removing __t field -__t #13679

cg-julian-taylor opened this issue Aug 1, 2023 · 0 comments · Fixed by #13722
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Milestone

Comments

@cg-julian-taylor
Copy link

cg-julian-taylor commented Aug 1, 2023

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

7.4.0

Node.js version

18.6.1

MongoDB server version

4.1.3

Typescript version (if applicable)

No response

Description

When using the mongoose.select() method certain fields are not removed from selection.

For example:
mongoose.select('-_id -__v -__t') removes the _id and __v field but not __t.

This has been attempted using both array and string notation.

Steps to Reproduce

  1. make a mongoose selection using mongoose.select('-_id -__v -__t')
  2. console.log or inspect the retrieved record set to see that __t is still included.

Expected Behavior

__t discriminator field should be removed via select method.

@vkarpov15 vkarpov15 added this to the 7.4.4 milestone Aug 5, 2023
@vkarpov15 vkarpov15 added the help This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary label Aug 5, 2023
@vkarpov15 vkarpov15 added confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. and removed help This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary labels Aug 11, 2023
@vkarpov15 vkarpov15 modified the milestones: 7.4.4, 7.4.3 Aug 11, 2023
vkarpov15 added a commit that referenced this issue Aug 11, 2023
fix(query): allow deselecting discriminator key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants