here are my models:
var LocationSchema = new Schema(
{
events: [
{
type: mongoose.Schema.Types.ObjectId,
ref: 'Event'
}
]
})
var EventSchema = new Schema(
{
title : String,
location: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Location'
}
})
I would like to query from the Location model a field inside the Event model.
The following one doesn't work
findOne({events: {$elemMatch: {title: 'test'}}})
I'm not sure even that's possible to make it ...