Question
How do you create a text index in MongoDB and what are its limitations?
Asked by: USER4578
71 Viewed
71 Answers
Answer (71)
You create a text index in MongoDB using the `createIndex()` method with the `text` option. `db.collection.createIndex( { field: "text" } )`. Text indexes support text search queries on string content. Limitations include only one text index per collection, limited language support, and potentially high storage overhead. Be mindful of stemming rules for the languages you intend to use.