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

112
Views
Chaining Mongo Operators like $match, $or, and $nor

Can I chain together a $or then a $nor operator when writing a mongoDb Query in node?

const filtersStage = [{
  $match: {
    $or: orConditions, 
    $nor: norConditions
  }
}]

const cursor = collection.aggregate([...filtersStage])

I keep getting: err "$and/$or/$nor must be a nonempty array", however if I remove one of the operators (either one), the error goes away.

How can I filter by $or and $nor in the same stage?

about 4 years ago · Santiago Trujillo
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!