in NodeJS with Mongoose, how do i search something in an array using findOne()? I want to search stuff like 626ead978edc5f2a3f7ca924 in the users array in my sessionCollection-Model. My DB looks like this: Database Picture
findOne()
626ead978edc5f2a3f7ca924
users
sessionCollection
It'll work normally as it does for non array key:
SessionCollection.findOne({users: mongoose.Types.ObjectId("626ead978edc5f2a3f7ca924")})
You might need to cast to objectId to get the desired result. Reference