summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/geo_near_random2.js
blob: aa09ebac6ff444e97fc753a44c6ae64e5934670a (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
// this tests 1% of all points using $near and $nearSphere
var db;
(function() {
    "use strict";
    load("jstests/libs/geo_near_random.js");

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

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

    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);
})();