~evarlast/ubuntu/utopic/mongodb/upstart-workaround-debian-bug-718702

« back to all changes in this revision

Viewing changes to jstests/geo_s2indexversion1.js

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-05-19 15:46:36 UTC
  • mfrom: (44.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20140519154636-ay43ao82iab9xgld
Tags: 1:2.4.10-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Add support for arm64:
    + d/control: Add arm64 to list of target architectures.
    + d/p/0001-Add-option-to-disable-javascript.patch,
      d/p/0001-SERVER-12064-Atomic-operations-for-gcc-non-Intel-arc.patch,
      d/p/0002-SERVER-12065-Support-ARM-and-AArch64-builds.patch:
      Patches to support arm64.
    + d/p/0005-ARM-support-for-ASM-operations-in-MongoDB.patch: Dropped in
      preference to above patches.
    + d/rules: Disable scripting on arm64.
  - d/p/0004-Support-ppc64el-builds.patch: Rebase on arm64 patches.
* d/mongodb-server.postinst: Call adduser with explicit --home.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Tests 2dsphere index option "2dsphereIndexVersion".  Verifies that only index version 1 is
 
2
// permitted.
 
3
 
 
4
var coll = db.getCollection("geo_s2indexversion1");
 
5
coll.drop();
 
6
 
 
7
//
 
8
// Index build should fail for invalid values of "2dsphereIndexVersion".
 
9
//
 
10
 
 
11
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": -1});
 
12
assert.gleError(db);
 
13
coll.drop();
 
14
 
 
15
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": 0});
 
16
assert.gleError(db);
 
17
coll.drop();
 
18
 
 
19
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": 2});
 
20
assert.gleError(db);
 
21
coll.drop();
 
22
 
 
23
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": 3});
 
24
assert.gleError(db);
 
25
coll.drop();
 
26
 
 
27
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": Infinity});
 
28
assert.gleError(db);
 
29
coll.drop();
 
30
 
 
31
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": "foo"});
 
32
assert.gleError(db);
 
33
coll.drop();
 
34
 
 
35
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": {a: 1}});
 
36
assert.gleError(db);
 
37
coll.drop();
 
38
 
 
39
//
 
40
// Index build should succeed for valid values of "2dsphereIndexVersion".
 
41
//
 
42
 
 
43
coll.ensureIndex({geo: "2dsphere"});
 
44
assert.gleSuccess(db);
 
45
coll.drop();
 
46
 
 
47
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": 1});
 
48
assert.gleSuccess(db);
 
49
coll.drop();
 
50
 
 
51
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": NumberInt(1)});
 
52
assert.gleSuccess(db);
 
53
coll.drop();
 
54
 
 
55
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": NumberLong(1)});
 
56
assert.gleSuccess(db);
 
57
coll.drop();
 
58
 
 
59
//
 
60
// Test compatibility of various GeoJSON objects with 2dsphere.
 
61
//
 
62
 
 
63
var pointDoc = {geo: {type: "Point", coordinates: [40, 5]}};
 
64
var lineStringDoc = {geo: {type: "LineString", coordinates: [[40, 5], [41, 6]]}};
 
65
var polygonDoc = {geo: {type: "Polygon", coordinates: [[[0, 0], [3, 6], [6, 1], [0, 0]]]}};
 
66
var multiPointDoc = {geo: {type: "MultiPoint",
 
67
                           coordinates: [[-73.9580, 40.8003], [-73.9498, 40.7968],
 
68
                                         [-73.9737, 40.7648], [-73.9814, 40.7681]]}};
 
69
var multiLineStringDoc = {geo: {type: "MultiLineString",
 
70
                                coordinates: [[[-73.96943, 40.78519], [-73.96082, 40.78095]],
 
71
                                              [[-73.96415, 40.79229], [-73.95544, 40.78854]],
 
72
                                              [[-73.97162, 40.78205], [-73.96374, 40.77715]],
 
73
                                              [[-73.97880, 40.77247], [-73.97036, 40.76811]]]}};
 
74
var multiPolygonDoc = {geo: {type: "MultiPolygon",
 
75
                             coordinates: [[[[-73.958, 40.8003], [-73.9498, 40.7968],
 
76
                                             [-73.9737, 40.7648], [-73.9814, 40.7681],
 
77
                                             [-73.958, 40.8003]]],
 
78
                                           [[[-73.958, 40.8003], [-73.9498, 40.7968],
 
79
                                             [-73.9737, 40.7648], [-73.958, 40.8003]]]]}};
 
80
var geometryCollectionDoc = {geo: {type: "GeometryCollection",
 
81
                                   geometries: [{type: "MultiPoint",
 
82
                                                 coordinates: [[-73.9580, 40.8003],
 
83
                                                               [-73.9498, 40.7968],
 
84
                                                               [-73.9737, 40.7648],
 
85
                                                               [-73.9814, 40.7681]]},
 
86
                                                {type: "MultiLineString",
 
87
                                                 coordinates: [[[-73.96943, 40.78519],
 
88
                                                                [-73.96082, 40.78095]],
 
89
                                                               [[-73.96415, 40.79229],
 
90
                                                                [-73.95544, 40.78854]],
 
91
                                                               [[-73.97162, 40.78205],
 
92
                                                                [-73.96374, 40.77715]],
 
93
                                                               [[-73.97880, 40.77247],
 
94
                                                                [-73.97036, 40.76811]]]}]}};
 
95
 
 
96
// {2dsphereIndexVersion: 1} indexes allow only Point, LineString, and Polygon.
 
97
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": 1});
 
98
assert.gleSuccess(db);
 
99
coll.insert(pointDoc);
 
100
assert.gleSuccess(db);
 
101
coll.insert(lineStringDoc);
 
102
assert.gleSuccess(db);
 
103
coll.insert(polygonDoc);
 
104
assert.gleSuccess(db);
 
105
coll.insert(multiPointDoc);
 
106
assert.gleError(db);
 
107
coll.insert(multiLineStringDoc);
 
108
assert.gleError(db);
 
109
coll.insert(multiPolygonDoc);
 
110
assert.gleError(db);
 
111
coll.insert(geometryCollectionDoc);
 
112
assert.gleError(db);
 
113
coll.drop();