I have a MongoDB database, where each object has a structure as follows:
{
"_id" : ObjectId("593b1bb421426f7245ef473e"),
"brand" : "Ford",
"model" : "Sierra",
"specific" : [
"Start",
"Car",
"Ford",
"Sierra "
]
}
Using Mongoose and Nodejs, I'd like make a query to find the objects where the second position of the array (index 1) matches with the "Car" value (inside the array placed in the "specific" key of the object).
My query at the moment is:
Car.find({specific: {1: 'Car'}}, function (err, vehicle) {
if (err) {
return err;
} else {
console.log(vehicle);
}
});
On the console is printing: [ ]
Any idea of how the query should be?