summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/geo_near_random2.js
blob: 6ee97cae624245df6a68b7efc0c680e74c395117 (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
25
26
27
28
29
30
31
// this tests 1% of all points using $near and $nearSphere
(function() {
"use strict";
load("jstests/libs/geo_near_random.js");

const conn = MongoRunner.runMongod();
assert.neq(null, conn, "mongod failed to start.");

var test = new GeoNearRandomTest("weekly.geo_near_random2", conn.getDB("test"));

test.insertPts(50000);

const opts = {
    sphere: 0,
    nToTest: test.nPts * 0.01
};
test.testPt([0, 0], opts);
test.testPt(test.mkPt(), opts);
test.testPt(test.mkPt(), opts);
test.testPt(test.mkPt(), opts);
test.testPt(test.mkPt(), opts);

opts.sphere = 1;
test.testPt([0, 0], opts);
test.testPt(test.mkPt(0.8), opts);
test.testPt(test.mkPt(0.8), opts);
test.testPt(test.mkPt(0.8), opts);
test.testPt(test.mkPt(0.8), opts);

MongoRunner.stopMongod(conn);
})();