I a have collection named people
and this collection have almost 100k documents
..
While I am a front-end dev, I don't know How can I boost my search performance.
I do search as below:
const phoneNumbers = [
{ "phone": { "$regex": `1` } },
{ "phone": { "$regex": `2` } },
{ "phone": { "$regex": `3` } },
{ "phone": { "$regex": `4` } },
{ "phone": { "$regex": `5` } },
{ "phone": { "$regex": `xxx` } },
{ "phone": { "$regex": `999` } },
{ "phone": { "$regex": `1000` } },
];
peopleCollection.find({$or: phoneNumbers}).toArray((error, matchedDocs)=> {
// returning matched docs
});
As you can see the structure of my search what is your suggestions to create index
?
Is that helpful to create index ? If yes how Can I create a proper index ?