diff options
Diffstat (limited to 'jstests/core/geo_s2multi.js')
-rw-r--r-- | jstests/core/geo_s2multi.js | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/jstests/core/geo_s2multi.js b/jstests/core/geo_s2multi.js index 8899c9d5561..d9a4032d070 100644 --- a/jstests/core/geo_s2multi.js +++ b/jstests/core/geo_s2multi.js @@ -21,8 +21,8 @@ multiPolygonA = { "coordinates": [ [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [ - [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], - [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] + [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], + [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] ] ] }; @@ -31,36 +31,33 @@ assert.writeOK(t.insert({geo: multiPolygonA})); assert.eq(3, t.find({ geo: {$geoIntersects: {$geometry: {"type": "Point", "coordinates": [100, 0]}}} }).itcount()); -assert.eq(3, - t.find({ - geo: {$geoIntersects: {$geometry: {"type": "Point", "coordinates": [101.0, 1.0]}}} - }).itcount()); +assert.eq(3, t.find({ + geo: {$geoIntersects: {$geometry: {"type": "Point", "coordinates": [101.0, 1.0]}}} + }).itcount()); // Inside the hole in multiPolygonA -assert.eq( - 0, t.find({ - geo: {$geoIntersects: {$geometry: {"type": "Point", "coordinates": [100.21, 0.21]}}} - }).itcount()); +assert.eq(0, + t.find({ + geo: {$geoIntersects: {$geometry: {"type": "Point", "coordinates": [100.21, 0.21]}}} + }).itcount()); // One point inside the hole, one out. assert.eq( - 3, - t.find({ - geo: { - $geoIntersects: - {$geometry: {"type": "MultiPoint", "coordinates": [[100, 0], [100.21, 0.21]]}} - } - }).itcount()); + 3, t.find({ + geo: { + $geoIntersects: + {$geometry: {"type": "MultiPoint", "coordinates": [[100, 0], [100.21, 0.21]]}} + } + }).itcount()); assert.eq( - 3, - t.find({ - geo: { - $geoIntersects: { - $geometry: - {"type": "MultiPoint", "coordinates": [[100, 0], [100.21, 0.21], [101, 1]]} - } - } - }).itcount()); + 3, t.find({ + geo: { + $geoIntersects: { + $geometry: + {"type": "MultiPoint", "coordinates": [[100, 0], [100.21, 0.21], [101, 1]]} + } + } + }).itcount()); // Polygon contains itself and the multipoint. assert.eq(2, t.find({geo: {$geoWithin: {$geometry: multiPolygonA}}}).itcount()); |