summaryrefslogtreecommitdiff
path: root/jstests/sharding
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2013-10-16 17:18:37 -0400
committerMatt Kangas <matt.kangas@mongodb.com>2013-10-24 15:19:57 -0400
commit6cfb561b21444b562df7f4e486b0cbd8de17ec42 (patch)
tree43aa625058caea7de388a314952f178b4fa27700 /jstests/sharding
parentbc05262b903baafd4a286008ab3323172d8c3275 (diff)
downloadmongo-6cfb561b21444b562df7f4e486b0cbd8de17ec42.tar.gz
SERVER-5588 mapReduce and eval not recognized by mongos
Diffstat (limited to 'jstests/sharding')
-rw-r--r--jstests/sharding/features1.js8
-rw-r--r--jstests/sharding/mapReduce.js17
2 files changed, 25 insertions, 0 deletions
diff --git a/jstests/sharding/features1.js b/jstests/sharding/features1.js
index 06fa446bd8a..3fb1ceb8916 100644
--- a/jstests/sharding/features1.js
+++ b/jstests/sharding/features1.js
@@ -88,6 +88,14 @@ assert.throws( function(){ db.eval( function(){ return db.foo2.findOne().a; } )
assert.eq( 1 , db.eval( function(){ return db.foo3.count(); } ), "eval 3 " );
assert.throws( function(){ db.eval( function(){ return db.foo2.count(); } ) } , null , "eval 4" )
+// ----- "eval" new command name SERVER-5588 -----
+var result;
+result = db.runCommand({eval: function () { return db.foo3.count(); } }); // non-sharded collection
+assert.eq(1, result.ok, "eval should work for non-sharded collection in cluster");
+
+result = db.runCommand({eval: function () { return db.foo2.count(); } }); // sharded collection
+assert.eq(0, result.ok, "eval should not work for sharded collection in cluster");
+
// ---- unique shard key ----
diff --git a/jstests/sharding/mapReduce.js b/jstests/sharding/mapReduce.js
index a10535b7d39..55168036fa7 100644
--- a/jstests/sharding/mapReduce.js
+++ b/jstests/sharding/mapReduce.js
@@ -103,3 +103,20 @@ assert(out.results != 'undefined', "no results for inline");
out = db.srcNonSharded.mapReduce(map, reduce, { out: { replace: "mrReplace" + suffix, db: "mrShardOtherDB", sharded: true } });
verifyOutput(out);
+
+// test new name "mapReduce", SERVER-5588
+out = db.runCommand({
+ mapReduce: "srcNonSharded", // use new name mapReduce rather than mapreduce
+ map: map,
+ reduce: reduce,
+ out: "mrBasic" + "srcNonSharded",
+ });
+verifyOutput(out);
+
+out = db.runCommand({
+ mapReduce: "srcSharded", // use new name mapReduce rather than mapreduce
+ map: map,
+ reduce: reduce,
+ out: "mrBasic" + "srcSharded",
+ });
+verifyOutput(out);