Search in mongoDb by first letter

Viewed 18

I'm trying to find all documents that start with the letter I'm looking for. But, since there are several million documents in the database, the search takes about 15 seconds.

How can I speed up the search? Right now I'm using this method: .find({title:{$regex: `^${letter}`}}

0 Answers
Related