mongoose select multiple fields code example
Example 1: return only specific attributes when making query mongoose
//query with mongoose
var query = dbSchemas.SomeValue.find({}).select('name');
Example 2: 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} ] })