My model looks like this:
Collection = new Schema({
name: {type: String, required: true},
tags: [String],
movies: [{_id: false,
original_title: {type: String}}]
)};
I need to alter the following query to use 'req.body' (an array of strings) to not only find a match in the 'tags' array but also find match(es) with the 'original_title' field in the movies array.
Collection.find({'tags' : { $in : req.body}}, (err, collections) => {
if(err){res.status(400).json(err);}
if(!collections)
{
res.status(404).json({message: 'No collections found'});
}else{
res.json(collections);
}
}).limit(8);