How to make OR MongoDB?

0 like 0 dislike
5 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 | 5 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,186 answers
0 comments
28,875 users