Reputation: 199
I want to be able to use $regex to be able to find any words that contain certain keyword given by user, but it is not working. I have this:
aggregatePipeline.push({
$match: {
name: {
$regex: `/${name.toLowerCase()}/`,
},
},
});
I tried using $regexMatch, but it says it is not supported for free tier. Is there a work around?
{
$regexMatch: {
input: "$name",
regex: `/${name}/`,
},
}
I'm trying to avoid $regexMatch at least for now due to free tier.
I am able to retrieve user by the exact name, but I also want to retreive all names that have a substring ex. 'ger', should retrieve 'Gerry', 'Gerald', 'anger'....
aggregatePipeline.push({ $match: { name: name.toLowercase() } });
Thanks a lot!
Upvotes: 0
Views: 74