Currently, I am working with a Mongoose schema that looks like this:
var MessageSchema = new Schema({
streamer: {
streamer_username: String,
streams: [{
id: String,
messages: [{
date: String,
username: String,
message: String,
song: String
}]
}]
}
})
Within this schema, there is an array called "streams" that contains objects with an "id" value. My attempt to query the database with the following code snippet has not been successful:
MsgSchema.find({ "streamer.streamer_username" : streamer_name, "streamer.streams": { "$in": {id: response.data[0].id} }}, (err, found) =>{}})
Despite trying variations of the query, it does not return any results and always results in an empty array. The issue seems to be with the second part of the query. I have reviewed the documentation but cannot identify what is wrong with my query. Can anyone provide insight on what might be the issue?