summaryrefslogtreecommitdiff
path: root/jstests/geo_oob_sphere.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/geo_oob_sphere.js')
-rw-r--r--jstests/geo_oob_sphere.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/jstests/geo_oob_sphere.js b/jstests/geo_oob_sphere.js
new file mode 100644
index 0000000..d493f36
--- /dev/null
+++ b/jstests/geo_oob_sphere.js
@@ -0,0 +1,42 @@
+//
+// 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 } })
+
+t.ensureIndex({ loc : "2d" })
+assert.isnull( db.getLastError() )
+
+t.find({ loc : { $nearSphere : [ 30, 91 ], $maxDistance : 0.25 } }).count()
+var err = db.getLastError()
+assert( err != null )
+printjson( err )
+
+t.find({ loc : { $nearSphere : [ 30, 89 ], $maxDistance : 0.25 } }).count()
+var err = db.getLastError()
+assert( err != null )
+printjson( err )
+
+t.find({ loc : { $within : { $centerSphere : [[ -180, -91 ], 0.25] } } }).count()
+var err = db.getLastError()
+assert( err != null )
+printjson( err )
+
+db.runCommand({ geoNear : "geooobsphere", near : [179, -91], maxDistance : 0.25, spherical : true })
+var err = db.getLastError()
+assert( err != null )
+printjson( err )
+
+db.runCommand({ geoNear : "geooobsphere", near : [30, 89], maxDistance : 0.25, spherical : true })
+var err = db.getLastError()
+assert( err != null )
+printjson( err ) \ No newline at end of file