As I find out, since version 3.8.9, mongoose support full text search. But I can\'t find a good documentation for it!
I want to do something like:
db.col
I found the following article that led me to the http://code.tutsplus.com/tutorials/full-text-search-in-mongodb--cms-24835 I dropped the index created in the top answer using the following
db.tablename.dropIndex({"indexname_text"})
I got the list of indexes with this command
db.tablename.getIndexes()
I then used the following to create the indexes
db.tablename.createIndex({"$**":"text"})
the following commands worked in Mongoose
model.find(
{$text: {$search: "text you are searching for"}},
{score: {$meta: "textScore"}})
.sort({score:{$meta:"textScore"}}
)
.exec(function(err, results) {
`enter code here`if(!err){
console.log('results ' + results);
}
else
{
console.log(err);
}
});