Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
$regex in mongodb pipeline

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!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

{ 'search field': { $regex: new RegExp('search name', 'gi') } }

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!