how do you poulate a field in a mongoose schema which is refrenced to another schema and this schema is further refrenced to another schema?

Mongoose supports nested populating (see in the docs: Note that you have to specify your model name of post schema where I´ve put the “post-model-name” placeholder.

So you could try something like this:

     path: 'viewed_posts',
     populate: {
       path: 'post',
       model: 'post-model-name'

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top