MongoDB
Text index and Text Search
To use text search upgrade to MongoDB 2.6+.
1. Create text index
> db.content.createIndex({"extract.description":"text"},{name:"tekstInd"}) -one field indexed as text
> db.content.createIndex({"extract.title":"text", "extract.description":"text"},{name:"tekstInd"})
queryDB = {
$text: { $search: q }
};
db.collection(collName).find(queryDB).sort({cid: -1}).skip(pagination_obj.skipNum).limit(pagination_obj.perPage).toArray(function (err, moContent_arr) {
if (err) { logg.byWinston('error', __filename + ':122 ' + err); }
//some code here
});