Mongoose 对象数组数组内部的pologulating字段

Mongoose 对象数组数组内部的pologulating字段,mongoose,mongoose-populate,Mongoose,Mongoose Populate,我的模型如下所示: const gallerySchema = new Schema({ pictures: [[{ title: String, file: { type: Schema.ObjectId, ref: 'asset', } }]], createdAt: Date }); 我想填充文件字段 我试过这个 Gallery .find({}) .populate({'path': 'pictures.file'}) 这不

我的模型如下所示:

const gallerySchema = new Schema({
  pictures: [[{
    title: String,
    file: {
      type: Schema.ObjectId,
      ref: 'asset',
    }
  }]],
  createdAt: Date
});
我想填充
文件
字段

我试过这个

Gallery
.find({})
.populate({'path': 'pictures.file'})

这不起作用。

为什么在另一个数组中有数组,您应该在其中添加一个带有数组字段的对象。这将使编写大多数查询更容易。为什么在另一个数组中有数组,您应该在其中添加一个带有数组字段的对象。这将使编写大多数查询更容易