I have a mongoose model with schema defined as -
var campusNotesSchema = mongoose.Schema({
noteId:{type:String, unique:true, default: uuid.v4()},
ti
You can user $or operator in mongoose to return results with either of matches
$or http://docs.mongodb.org/manual/reference/operator/query/or/
Campusnotes.find({'$or':[{title:new RegExp(searchText,'i')},{description:new RegExp(searchText,'i')}]}).exec(function(err, collection) {
res.send(collection);
})
To search in array for matching strings, you need to use $in operator of mongo:
$in : http://docs.mongodb.org/manual/reference/operator/query/in/