mongoose search from array code example
Example 1: mongoose search in multiple fields
let regex = new RegExp(value.searchQuery,'i');
const filterd = await Model.find({ $and: [ { $or: [{title: regex },{description: regex}] }, {category: value.category}, {city:value.city} ] })
Example 2: mongoose search by name
let ids = ['id1','id2','id3']
let data = await MyModel.find(
{'_id': { $in: ids}}
);