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

Add a global strictPopulate option #10694

Closed
neubee opened this issue Sep 8, 2021 · 0 comments · Fixed by #11006
Closed

Add a global strictPopulate option #10694

neubee opened this issue Sep 8, 2021 · 0 comments · Fixed by #11006
Assignees
Labels
new feature This change adds new functionality, like a new method or class
Milestone

Comments

@neubee
Copy link

neubee commented Sep 8, 2021

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
Are there any plans to add a global option (like those listed at https://mongoosejs.com/docs/api/mongoose.html#mongoose_Mongoose-set) for strictPopulate? I would much prefer such an option instead of setting the more impactful strict option to false for my models, #5124 (comment)
I'm dealing with a older codebase that has many populates and it's very difficult to track down which ones are using paths that don't exist. Also, there is extensive use of the following pattern

.populate({
  path: 'aPath',
  populate: {
    path: 'x y z',
    populate: {
      path: 'subPath1',
    },
  },
})

Where subPath1 is only defined for a subset of x, y, and z. In my testing, if subPath1 is not defined for x, y, and z the strictPopulate error is thrown.

If a global option is out of the question, could this be added as a schema level option instead (or in addition).

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
node: 12.15.0
mongoose: 6.0.5
mongo: 4.4.5

@IslandRhythms IslandRhythms added the new feature This change adds new functionality, like a new method or class label Sep 8, 2021
@vkarpov15 vkarpov15 added this to the 6.1.0 milestone Sep 8, 2021
@vkarpov15 vkarpov15 modified the milestones: 6.1.0, 6.2.0 Nov 17, 2021
@IslandRhythms IslandRhythms linked a pull request Nov 23, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This change adds new functionality, like a new method or class
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants