> db.s.insert({"name": "is"})
|
WriteResult({ "nInserted" : 1 })
|
> db.s.insert({"name": "dog"})
|
WriteResult({ "nInserted" : 1 })
|
> db.s.createIndex({"name": "text"})
|
{
|
"createdCollectionAutomatically" : false,
|
"numIndexesBefore" : 1,
|
"numIndexesAfter" : 2,
|
"ok" : 1
|
}
|
> db.s.find({$text: {$search: "is"}}) *why there are no results?*
|
> db.s.find({$text: {$search: "dog"}})
|
{ "_id" : ObjectId("578287a4a2bdbd1636963ee3"), "name" : "dog" }
|
> db.s.insert({"name": "this"})
|
WriteResult({ "nInserted" : 1 })
|
> db.s.insert({"name": "cat"})
|
WriteResult({ "nInserted" : 1 })
|
> db.s.find({$text: {$search: "cat"}})
|
{ "_id" : ObjectId("578287dba2bdbd1636963ee5"), "name" : "cat" }
|
> db.s.find({$text: {$search: "this"}})
|