Vladimir Vladimir - 1 year ago 60
Node.js Question

How to display data only which can populate[mongoose]

Is possible to display details from collection where has inside population

role: '4edd40c86762e0fb12000002'

userId: userId
.populate('recommendedBy',{role: '4edd40c86762e0fb12000002'})
.exec(handle().many.bind(null, 'message', res));

So for result where
return null I also don't need record from
for that

Answer Source

If I'm understanding your question correctly you could perform a filter after your populate in your .exec. Check out this answer for more details on the implementation.