Node virtual relationship
virtual
user.virtual('tasks', {
ref:'Task',
localField:'_id',
foreignField:'owner'
})
get data
const tasks = await req.user.populate(
'tasks'
).execPopulate()
Comments
Join the discussionNo comments yet. Be the first to comment.