Reputation: 227
i have such query
Order.find({patient:req.user._id})
.populate({
path:'doctor',
populate:{
path:'specialization',
select:'-_id'
},
})
in this query, if I remove select - everything is working, but when i want select fields which i want (not all ), (select as option working on first level population ) populate no working, can you help me?
Upvotes: 2
Views: 406
Reputation: 638
This may be occurring because your nested populate
is an option for .populate({})
and thus may not have a select
option. See the Populating across multiple levels section of this documentation.
You could also try recursively populating. See this answer for more details.
Upvotes: 1