I have a structure that looks like this:
Model: {
"name":"testing",
"details":["detail1","detail2","detail10"]
}
How does one go about finding all instances where an above structure contains an instance of detail2 within their details property? I've tried:
Model.find({where:{details:{elemMatch:{"detail2"}}}},function(err,models){
console.log(models);
console.log(err);
});
and:
Model.find({details:"detail2"},function(err, models){
//throws [Error: Items must be an array: "details2"]
});