Book Image

MongoDB Cookbook

By : Amol Nayak
Book Image

MongoDB Cookbook

By: Amol Nayak

Overview of this book

<p>MongoDB is a high-performance and feature-rich NoSQL database that forms the backbone of numerous complex development systems. You will certainly find the MongoDB solution you are searching for in this book.</p> <p>Starting with how to initialize the server in three different modes with various configurations, you will then learn a variety of skills including the basics of advanced query operations and features in MongoDB and monitoring and backup using MMS. From there, you can delve into recipes on cloud deployment, integration with Hadoop, and improving developer productivity. By the end of this book, you will have a clear idea about how to design, develop, and deploy MongoDB.</p>
Table of Contents (17 chapters)
MongoDB Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Implementing a full-text search in MongoDB


Many of us (I won't be wrong if I say all of us) use Google every day to search content on the Web. To cut a long story short, the text that we provide in the textbox on Google's page is used to search the pages on the Web that it has indexed. The search results are then returned to us in an order determined by Google's page rank algorithm. We might want to have a similar functionality in our database that lets us search for some text content and gives the corresponding search results. Note that this text search is not the same as finding the text as part of a sentence, which can easily be done using regex. It goes way beyond that and can be used to get results that contain the same, are similar sounding, or have a similar base word; we can even return even a synonym in the actual sentence.

Since MongoDB Version 2.4, the text indexes introduced let us create text indexes on a particular field in the document and enable text search on those words...