Answer the question
In order to leave comments, you need to log in
How to OR in MongoDB?
To select fields by conjunction of two conditions, we simply write:
db.blabla.find({ field1: value1, field2: value2 })
but how to make the query be with disjunction? To select everything, where field1 = value1 OR field2 = value2?
Maybe I'm very bad at reading mana, but I've been fighting for a long time, usually I found a way to get around (sometimes through $in, if the field is one), but now I'm at an impasse.
upd: While I was publishing the post, I found that the $or feature was added in 1.5.3. That is, in 1.4 there is no way? How did you live before?
Answer the question
In order to leave comments, you need to log in
And since when did the use of nosql become convenient?
Be patient. Write two requests.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question