db.collection.createIndex({"type_name":"text"});
db.collection.find();
Outputs:
{ "type_id" : "10735", "type_name" : "Tycho" }
{ "type_id" : "1550", "type_name" : "Trina" }
{ "type_id" : "12925", "type_name" : "Tiffany" }
{ "type_id" : "1637", "type_name" : "The Wombats" }
{ "type_id" : "11470", "type_name" : "The Wanted" }
Using:
db.collection.find({'$text':{'$search':"The Wombats"}})
Outputs:
{ "type_id" : "1637", "type_name" : "The Wombats" }
Using:
db.collection.find({'$text':{'$search':"Wombats"}});
Outputs:
{ "type_id" : "1637", "type_name" : "The Wombats" }
But when I try :
db.collection.find({'$text':{'$search':"The"}});
Output:
0
I am expecting a different output, what is wrong?