Skip to content

Nested object populate does not work #835

Closed Answered by wasya243
wasya243 asked this question in Q&A
Discussion options

You must be logged in to vote

virtual options are not inherited by nested classes, so use on each class that is gonna use populates:

schemaOptions: {
        toJSON: { virtuals: true },
        toObject: { virtuals: true }
    }

Also if you have array that is array of some class instances that use populate you should use toObject({virtuals: true}) to get populated values in console.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@wasya243
Comment options

@hasezoey
Comment options

@wasya243
Comment options

@hasezoey
Comment options

@wasya243
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by wasya243
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #834 on May 16, 2023 15:42.