I am trying to create a text index to implement text search in mongodb using nodejs.
Example:
db.collection("test").ensureIndex( { name: 'text', description: 'text' }, { weights: { name: 10, description: 20 }, name: 'test' }, function(err, data){ // here err is null, and data is "test" });
After that I try to get information about this index with the name "test", it gives me data such as
{ v: 1, key: { _fts: 'text', _ftsx: 1 }, ns: '53b3e49b31afd3d3354886b7_rajeshdemo.test', name: 'test', weights: { description: 1, name: 1 }, default_language: 'english', language_override: 'language', textIndexVersion: 1 }
He does not accept weight information.
How to create a text search index in mongodb (version 2.6) using nodejs?
source share