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

1.8K
Views
'Or' statement in mongo-db compass

enter image description here

In Mongodb compass. I want to search a collection for the word "LLC" in Both the ownerName and ownerStreet properties (I don't have a text index.) I started with :

{ownerName: {$regex: / LLC/i}}

which gives 3043 results.

However using:

{ownerName: {$regex: RegExp(' LLC')},ownerStreet: {$regex: RegExp(' LLC')}}

gives only 100

meaning this is an 'and' statement not an 'or'

How do I use an 'or' statement filter in compass?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use the $or operator.

db.collection.find({
  $or: [
    {
      ownerName: { $regex: RegExp(' LLC') }
    },
    {
      ownerStreet: { $regex: RegExp(' LLC') }
    }
  ]
})

You can even simplify it to

db.collection.find({
  $or: [
    {
      ownerName: / LLC/
    },
    {
      ownerStreet: / LLC/
    }
  ]
})
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!