Answer the question
In order to leave comments, you need to log in
How to make a selection with populate?
I don’t understand how to make a selection by the fields that populate fills
The selection itself
Posts
.find({
public: true
}, {
id: 1,
url: 1
})
.sort({ createdAt: -1 })
.skip(d.query.skip)
.limit(d.query.limit)
.populate('likes', 'id')
.populate('owner', 'id name username avatar')
.populate('catalog', 'id url name', {'url': 'CATALOG_NAME'})
.exec((e, data) => {
return c(e, data)
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question