> db.foo.ensureIndex({a:"text",b:1})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.insert({a:"hello world",b:1})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.find({$text:{$search:"hello"},b:1})
|
{ "_id" : ObjectId("531518053d6c9988adb3eed4"), "a" : "hello world", "b" : 1 }
|
> db.foo.find({$text:{$search:"hello"},b:1}).explain()
|
{
|
"cursor" : "TextCursor",
|
"n" : 1,
|
"nscannedObjects" : 0, // Incorrect, should be 1 (query fetches "_id" and "a" from document)
|
"nscanned" : 1,
|
"nscannedObjectsAllPlans" : 0,
|
"nscannedAllPlans" : 1,
|
"scanAndOrder" : false,
|
"nYields" : 0,
|
"nChunkSkips" : 0,
|
"millis" : 0,
|
"server" : "Rassi-MacBook-Pro.local:27017",
|
"filterSet" : false
|
}
|
>
|
|