diff options
author | gregs <greg@10gen.com> | 2011-05-06 10:22:08 -0400 |
---|---|---|
committer | gregs <greg@10gen.com> | 2011-05-06 13:31:26 -0400 |
commit | aa13edaae8449d76d16d3931428c6bd922cbb81f (patch) | |
tree | 229178cdfa416c175f0f49196a9e1746a22ada83 /jstests | |
parent | be124009c226d122979fb11623dc3f98aaa1c3be (diff) | |
download | mongo-aa13edaae8449d76d16d3931428c6bd922cbb81f.tar.gz |
check spherical earth query bounds SERVER-2980
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/geo_oob_sphere.js | 42 |
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 00000000000..d493f3698ba --- /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 |