summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2014-08-21 14:53:12 -0400
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2014-08-22 14:37:55 -0400
commitc8844c031b7d2bd7bed5920fc869cedd14a9460f (patch)
tree6dcf3489ed1e9cae7e57b27b75889922b1a877d9 /jstests
parent2b23514f91c1ab0cc6b8f7e928138fbf513ce34e (diff)
downloadmongo-c8844c031b7d2bd7bed5920fc869cedd14a9460f.tar.gz
SERVER-14984 Server aborts when running $centerSphere query with NaN radius
(cherry picked from commit 8dd902ab53e340aac9cf570f4b3c42f139694707)
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/geo_validate.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/jstests/core/geo_validate.js b/jstests/core/geo_validate.js
index f783d08a5eb..b1cfd3cad61 100644
--- a/jstests/core/geo_validate.js
+++ b/jstests/core/geo_validate.js
@@ -16,6 +16,18 @@ assert.throws(function(){
assert.throws(function(){
coll.findOne({ geo : { $within : { $centerSphere : [[0, 0], -1] } } });
});
+assert.throws(function(){
+ coll.findOne({ geo : { $within : { $center : [[0, 0], NaN] } } });
+});
+assert.throws(function(){
+ coll.findOne({ geo : { $within : { $centerSphere : [[0, 0], NaN] } } });
+});
+assert.throws(function(){
+ coll.findOne({ geo : { $within : { $center : [[0, 0], -Infinity] } } });
+});
+assert.throws(function(){
+ coll.findOne({ geo : { $within : { $centerSphere : [[0, 0], -Infinity] } } });
+});
//
//
@@ -23,6 +35,8 @@ assert.throws(function(){
assert.writeOK(coll.insert({ geo : [0, 0] }));
assert.neq(null, coll.findOne({ geo : { $within : { $center : [[0, 0], 0] } } }));
assert.neq(null, coll.findOne({ geo : { $within : { $centerSphere : [[0, 0], 0] } } }));
+assert.neq(null, coll.findOne({ geo : { $within : { $center : [[0, 0], Infinity] } } }));
+assert.neq(null, coll.findOne({ geo : { $within : { $centerSphere : [[0, 0], Infinity] } } }));
//
//
@@ -33,9 +47,25 @@ assert.throws(function(){
assert.throws(function(){
coll.findOne({ geo : { $geoNear : [0, 0], $maxDistance : -1 } });
});
+assert.throws(function(){
+ coll.findOne({ geo : { $geoNear : [0, 0, NaN] } });
+});
+assert.throws(function(){
+ coll.findOne({ geo : { $geoNear : [0, 0], $maxDistance : NaN } });
+});
+assert.throws(function(){
+ coll.findOne({ geo : { $geoNear : [0, 0, -Infinity] } });
+});
+assert.throws(function(){
+ coll.findOne({ geo : { $geoNear : [0, 0], $maxDistance : -Infinity } });
+});
//
//
// Make sure we can't do a near search with a negative limit
assert.commandFailed(db.runCommand({geoNear: coll.getName(),
near: [0,0], spherical: true, num: -1}));
+assert.commandFailed(db.runCommand({geoNear: coll.getName(),
+ near: [0,0], spherical: true, num: NaN}));
+assert.commandFailed(db.runCommand({geoNear: coll.getName(),
+ near: [0,0], spherical: true, num: -Infinity}));