summaryrefslogtreecommitdiff
path: root/jstests/core/geo_withinquery.js
blob: 13f20c1433fad9ccfdf441c2bf4620de493d9a41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// @tags: [
//   requires_getmore,
// ]

// SERVER-7343: allow $within without a geo index.
t = db.geo_withinquery;
t.drop();

num = 0;
for (x = 0; x <= 20; x++) {
    for (y = 0; y <= 20; y++) {
        o = {_id: num++, loc: [x, y]};
        t.save(o);
    }
}

assert.eq(21 * 21 - 1,
          t.find({
               $and: [
                   {loc: {$ne: [0, 0]}},
                   {loc: {$within: {$box: [[0, 0], [100, 100]]}}},
               ]
           }).itcount(),
          "UHOH!");