How does mongoose find a value in an array?

for example

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}

})

I need to find it through the id passed in, and the participant contains the data of the id

Mar.28,2021

I'm not familiar with mongooes, so I wrote queries
I don't know what's inside your participant
if it's

participant:[1,2,3]

then look for id is 1, then the query condition is

{participant:{$elemMatch:{$eq:1}}}

if it is

 participant:[{id:1,num:5}]

then look for id is 1, then the query condition is

{participant:{$elemMatch:{id:1}}}

$elemMatch

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9ec89-5c81e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9ec89-5c81e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?