I have a mongoose schema that models a user in a social network. In it i want to save an array of all the chats that a user has, a chat consists of a responent (the user a user is chatting with), and an array that represents the conversation.
var userSchema = mongoose.Schema({
email : String,
chats : [{ respondent : String, conversation : [{ message: String, author : String}]}],
});
How do i find an item in chats that contains a perticular respondent? In the item found, id like to push a message to the conversation.