在第二个参数中填写字符串,需要查询的字段用空格相连。
const Person = mongoose.model('Person', yourSchema);
// 查询每个 last name 是 'Ghost' 的 person, select `name` 和 `occupation` 字段
Person.findOne({ 'name.last': 'Ghost' }, 'name occupation');
官方文档 https://cn.mongoosedoc.top/docs/queries.html