> use test2
switched to db test2
> db.tweets.save( {_id:1,comments:["this is important",{b:"this is unimportant"},"green",{b:"blue"}]} );
> db.tweets.ensureIndex({ "comments.b" : "text" });
> db.tweets.runCommand("text",{ search : "unimportant" });
{
"queryDebugString" : "unimport||||||",
"language" : "english",
"results" : [
{
"score" : 1,
"obj" : {
"_id" : 1,
"comments" : [
"this is important",
{
"b" : "this is unimportant"
},
"green",
{
"b" : "blue"
}
]
}
}
],
"stats" : {
"nscanned" : 1,
"nscannedObjects" : 0,
"n" : 1,
"nfound" : 1,
"timeMicros" : 122
},
"ok" : 1
}
> db.tweets.runCommand("text",{ search : "important" });
{
"queryDebugString" : "import||||||",
"language" : "english",
"results" : [
{
"score" : 1,
"obj" : {
"_id" : 1,
"comments" : [
"this is important",
{
"b" : "this is unimportant"
},
"green",
{
"b" : "blue"
}
]
}
}
],
"stats" : {
"nscanned" : 1,
"nscannedObjects" : 0,
"n" : 1,
"nfound" : 1,
"timeMicros" : 89
},
"ok" : 1
}