例如
const ProjectSchema = new mongoose.Schema({
name : { type:String },
time : { type:Date, default:Date.now },
url : { type: String},
user : { type: Object},
proId : {type: String},
spaceId : {type: String},
description: {type: String},
participant: {type: Array}
})
我需要 通过 传入的id 查找,participant里面含有该id的数据
mongooes我不怎么熟,所以我就写查询语句了
我不知道你的participant内部是什么结构
假如是
然后要找id是1,那么查询条件是
假如是
然后要找id是1,那么查询条件是
$elemMatch