summaryrefslogtreecommitdiff
path: root/jstests/core/ork.js
blob: f367b6b4badfba6f167b148bb5705ae5834211c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// SERVER-2585 Test $or clauses within indexed top level $or clauses.

t = db.jstests_ork;
t.drop();

t.ensureIndex({a: 1});
t.save({a: [1, 2], b: 5});
t.save({a: [2, 4], b: 5});

assert.eq(2,
          t.find({
              $or: [
                  {a: 1, $and: [{$or: [{a: 2}, {a: 3}]}, {$or: [{b: 5}]}]},
                  {a: 2, $or: [{a: 3}, {a: 4}]}
              ]
          }).itcount());
assert.eq(1,
          t.find({
              $or: [
                  {a: 1, $and: [{$or: [{a: 2}, {a: 3}]}, {$or: [{b: 6}]}]},
                  {a: 2, $or: [{a: 3}, {a: 4}]}
              ]
          }).itcount());