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

92
Views
mongodb filter where property not ends with

I have a mongodb collection with documents structured like this

{
   ...
   "ownerName":"Bob",   
   "city":"Oregon",
   "refNote":"sadkj1233233@qwertz",
}

I want to filter and select only documents where refNote not ends with @qwertz

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use regular expression and $not operator,

  • $regex to pass string that you want to search, specify $ at the end of string to search exact from end of the string,
  • $not to check opposit condition
db.collection.find({
  refNote: {
    $not: {
      $regex: "@qwertz$"
    }
  }
})

Playground

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!