How to make OR MongoDB?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
13 views
To select fields at the conjunction of two conditions simply write:
db.blabla.find({ field1: value1, field2: value2 })

how to make a query with the disjunction? To choose all the where field1 = value1 OR field2 = value2?

Maybe I'm very difficult to read mana, but I have long, usually found a way around (sometimes through $in, if you field one), but now stuck.

upd: While I published the post, I found that feature $or was added in 1.5.3. That is, in 1.4 there isn't? As before lived?
by | 13 views

2 Answers

0 like 0 dislike
And since when is the use of nosql has become udobnenko?
Be patient. Write two queries.
by
0 like 0 dislike
1.4 method there. Basta :-) you Can do (but very slow) or putting one of kriteriev find js code where you can do anything.
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users