Reputation: 7705
I have the following nested object stored in my mongoDB:
var Appointment = new Schema ({
students: [{user1:String,user2:String, _id: false}],
});
I now want to query my appointments for a studentName which is stored in the array students either in user1 or user2. But I have no idea how I could achieve that? If it is an array I would use:
Appointment.find({
students: {$in: [studentName]}
}, function(err, appointmentsDb) {
// do something
});
Upvotes: 0
Views: 54