📜  从 mongoose 填充某些字段 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:09.549000             🧑  作者: Mango

代码示例1
Model
.find(query)
.populate({
  path: 'key_with_ref',
  model: 'model_name',
  select: { 'field_name': 1,'field_name':1},
})
 
-OR-

Model
.find(query)
.populate({
  path: 'key_with_ref',
  model: 'model_name',
  select: 'field_name, field_name',
})