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

217
Views
How can I remove the quotation mark for my value in $in operator?

I want to do a collection.find() with filter in MongoDB. However, I need to pass a variable inside my $in operator to have exactly this format :

{ '$in': [ /^S/ ] }

But I actually have this format :

{ '$in': [ '/^S/' ] }

With this code :

let term = req.query.term;
console. log ("term:", term);
const filter = {
  "firstname": { $in: ("/^ + term + "/"] }
};
console. log(filter);
const answer = await collection.find (filter). toArray();
about 4 years ago · Santiago Gelvez
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!