"_id": ObjectId ("53493d14d852429c10000002"),
"post_text": "enjoy the mongodb articles on tutorialspoint",
"tags": ["mongodb", "tutorialspoint"]
}
{
"_id": ObjectId ("53493d1fd852429c10000003"),
"post_text": "writing tutorials on mongodb",
"tags": ["mongodb", "tutorial"]
}
If you are using an older version of MongoDB, you must use the following command:
> db . posts . runCommand ( "text" ,{ search : " tutorialspoint " })
The use of Text Search significantly improves search efficiency when compared to regular search.
To delete an existing Text Index, first find the index's name using the query:
> db . posts . getIndexes ()
After taking the name of the index from the above query, run the following command. Here, post_text_text is the name of the index.
> db . posts . dropIndex ( "post_text_text" )
According to Tutorialspoint
Previous article: Map Reduce in MongoDB
Next post: Regular Expression in MongoDB