Mongoose populate sub-sub document

后端 未结 9 1952
深忆病人
深忆病人 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条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 03:27

    This worked for me:

    i.e. no need for model

        .populate({
          path: 'filters',
          populate: {
            path: 'tags',
            populate: {
              path: 'votes.user'
            }
          }
        })
        .populate({
          path: 'members'
        })

提交回复
热议问题