summaryrefslogtreecommitdiff
path: root/jstests/core/geo_oob_sphere.js
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2014-03-27 16:31:25 -0400
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2014-03-28 12:44:07 -0400
commitec89a420a86c3c918f4bd634fc2134db0a9eb154 (patch)
tree2a73d51897b0986e35f220d5834e11d4d2017138 /jstests/core/geo_oob_sphere.js
parenta924eeb8934297f2a499bb0e50cd6835b1741281 (diff)
downloadmongo-ec89a420a86c3c918f4bd634fc2134db0a9eb154.tar.gz
SERVER-13386 Move tests with getPrevError to gle test suite
Ignore getPrevError in gle sharding test Migrate geo_oob_sphere.js
Diffstat (limited to 'jstests/core/geo_oob_sphere.js')
-rw-r--r--jstests/core/geo_oob_sphere.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/jstests/core/geo_oob_sphere.js b/jstests/core/geo_oob_sphere.js
new file mode 100644
index 00000000000..59343e7d7ac
--- /dev/null
+++ b/jstests/core/geo_oob_sphere.js
@@ -0,0 +1,31 @@
+//
+// Ensures spherical queries report invalid latitude values in points and center positions
+//
+
+t = db.geooobsphere
+t.drop();
+
+t.insert({ loc : { x : 30, y : 89 } })
+t.insert({ loc : { x : 30, y : 89 } })
+t.insert({ loc : { x : 30, y : 89 } })
+t.insert({ loc : { x : 30, y : 89 } })
+t.insert({ loc : { x : 30, y : 89 } })
+t.insert({ loc : { x : 30, y : 89 } })
+t.insert({ loc : { x : 30, y : 91 } })
+
+assert.commandWorked(t.ensureIndex({ loc : "2d" }))
+
+assert.throws( function() { t.find({ loc : { $nearSphere : [ 30, 91 ], $maxDistance : 0.25 } }).count() } );
+
+assert.throws( function() { t.find({ loc : { $nearSphere : [ 30, 89 ], $maxDistance : 0.25 } }).count() } );
+
+assert.throws( function() { t.find({ loc : { $within : { $centerSphere : [[ -180, -91 ], 0.25] } } }).count() } );
+
+var res;
+res = db.runCommand({ geoNear : "geooobsphere", near : [179, -91], maxDistance : 0.25, spherical : true })
+assert.commandFailed( res )
+printjson( res )
+
+res = db.runCommand({ geoNear : "geooobsphere", near : [30, 89], maxDistance : 0.25, spherical : true })
+assert.commandFailed( res )
+printjson( res )