I just started with Mongoose and having issues finding elements...
My schema contains an array of subregions from which I want to find the matching one by its code. The schema is the following:
var schema = {
name: {
type: String,
required: true
}
...
subRegions: [{
name: {
type: String,
required: true
},
code: {
type: String,
required: true
}
}]
...
};
I came up with
find({
subRegions: {
"$in": [{
code: regionCode
}]
}
}).exec(...)
but this is not working...