Mongoose populate sub-sub document

后端 未结 9 1964
深忆病人
深忆病人 2021-01-30 03:00

I have this setup in my MongoDB

Items:

title: String
comments: [] // of objectId\'s

Comments:

user: ObjectId()
item: Ob         


        
9条回答
  •  暖寄归人
    2021-01-30 03:21

    do it try it`s working find Project and get project related populate Task and Perticular Task User find

    db.Project.find()
    .populate({
        path: 'task',
        populate: { path: 'user_id'}
    })
    .exec(async(error,results)=>{
    
    })
    

提交回复
热议问题