I have a shoes collection with about 1.4 millions records. I tried to get list of shoes containing “Adidas Men’s Clinch-X M Running Shoe” phrase. At first, I did not index the “name” column and perform query using $regex. Later, I tried using text indexes at “name” column and perform query using $text and $search. The result surprised me as the non-index query is much faster than text indexes query.
Normal Result
Text Indexes Result
Here’s my queries:
- $regex: {name: {$regex: “Adidas Men’s Clinch-X M Running Shoe” }}
- $text: {$text: {$search: “”Adidas Men’s Clinch-X M Running Shoe””}}
untaminh1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.