1. Create sample collection: test
2. Create sample text index:
db.getCollection('test').createIndex( { name: "text" } )
|
3. Feed collection with some documents:
{
|
"_id" : ObjectId("58230e1a2061b3081d657f3f"),
|
"name" : "1"
|
}
|
{
|
"_id" : ObjectId("58230f972061b3081d657f40"),
|
"name" : "TEST OTHER"
|
}
|
{
|
"_id" : ObjectId("58230f9d2061b3081d657f41"),
|
"name" : "TEST OTHERS"
|
}
|
{
|
"_id" : ObjectId("582310352061b3081d657f42"),
|
"name" : "OTHER"
|
}
|
4. Do search request with "OTHER" keyword
db.getCollection('test').find({ $text: { $search: "OTHER" } })
|
There are no documents returned. If word "OTHER" was changed to "OTHERS" - everything is ok - 1 document returned.