summaryrefslogtreecommitdiff
path: root/jstests/core/geo_s2validindex.js
blob: 4c024d2d585c6f46f6a10411c04dbf538c3965f3 (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
//
// Tests valid cases for creation of 2dsphere index
//

var coll = db.getCollection("twodspherevalid");

// Valid index
coll.drop();
assert.commandWorked(coll.ensureIndex({geo: "2dsphere", other: 1}));

// Valid index
coll.drop();
assert.commandWorked(coll.ensureIndex({geo: "2dsphere", other: 1, geo2: "2dsphere"}));

// Invalid index, using hash with 2dsphere
coll.drop();
assert.commandFailed(coll.ensureIndex({geo: "2dsphere", other: "hash"}));

// Invalid index, using 2d with 2dsphere
coll.drop();
assert.commandFailed(coll.ensureIndex({geo: "2dsphere", other: "2d"}));

jsTest.log("Success!");

// Ensure the empty collection is gone, so that small_oplog passes.
coll.drop();