MongoDB - Search - Interview Questions

What are text indexes in MongoDB?

 

MongoDB provides text indexes to support and optimize text search queries on text content. Text indexes can include one or more fields whose value is a string or an array of strings.

A collection can have only one text index, but that single text index can include multiple fields

For example, below operation creates a text index on fname and lname fields in the employees collection

>db.employees.createIndex({fname:"Text", lname:"Text"})
 
Subscribe to our Questions

 

MongoDB - Interview Questions

MongoDB - BasicsMongoDB - CreateMongoDB - ReadMongoDB - UpdateMongoDB - DeleteMongoDB - SearchMongoDB - AggregationMongoDB - Data ModelingMongoDB - Data ReplicationMongoDB - ShardingMongoDB - SecurityMongoDB - Administration
 
RECOMMENDED RESOURCES
Behaviorial Interview
Top resource to prepare for behaviorial and situational interview questions.

STAR Interview Example