summaryrefslogtreecommitdiff
path: root/jstests/sharding/mapReduce_nonSharded.js
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/sharding/mapReduce_nonSharded.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/sharding/mapReduce_nonSharded.js')
-rw-r--r--jstests/sharding/mapReduce_nonSharded.js37
1 files changed, 20 insertions, 17 deletions
diff --git a/jstests/sharding/mapReduce_nonSharded.js b/jstests/sharding/mapReduce_nonSharded.js
index 4e36335047b..40fb098931b 100644
--- a/jstests/sharding/mapReduce_nonSharded.js
+++ b/jstests/sharding/mapReduce_nonSharded.js
@@ -6,27 +6,29 @@ var verifyOutput = function(out) {
assert.eq(out.counts.output, 512, "output count is wrong");
};
-var st = new ShardingTest({ shards : 2,
- verbose : 1,
- mongos : 1,
- other : { chunkSize: 1, enableBalancer: true }});
+var st = new ShardingTest(
+ {shards: 2, verbose: 1, mongos: 1, other: {chunkSize: 1, enableBalancer: true}});
-st.adminCommand( { enablesharding : "mrShard" } );
+st.adminCommand({enablesharding: "mrShard"});
st.ensurePrimaryShard('mrShard', 'shard0001');
-st.adminCommand( { shardcollection : "mrShard.srcSharded", key : { "_id" : 1 } } );
+st.adminCommand({shardcollection: "mrShard.srcSharded", key: {"_id": 1}});
-var db = st.getDB( "mrShard" );
+var db = st.getDB("mrShard");
var bulk = db.srcNonSharded.initializeUnorderedBulkOp();
for (j = 0; j < 100; j++) {
for (i = 0; i < 512; i++) {
- bulk.insert({ j: j, i: i });
+ bulk.insert({j: j, i: i});
}
}
assert.writeOK(bulk.execute());
-function map() { emit(this.i, 1); }
-function reduce(key, values) { return Array.sum(values); }
+function map() {
+ emit(this.i, 1);
+}
+function reduce(key, values) {
+ return Array.sum(values);
+}
// non-sharded in/out
var suffix = "";
@@ -34,26 +36,27 @@ var suffix = "";
out = db.srcNonSharded.mapReduce(map, reduce, "mrBasic" + suffix);
verifyOutput(out);
-out = db.srcNonSharded.mapReduce(map, reduce, { out: { replace: "mrReplace" + suffix } });
+out = db.srcNonSharded.mapReduce(map, reduce, {out: {replace: "mrReplace" + suffix}});
verifyOutput(out);
-out = db.srcNonSharded.mapReduce(map, reduce, { out: { merge: "mrMerge" + suffix } });
+out = db.srcNonSharded.mapReduce(map, reduce, {out: {merge: "mrMerge" + suffix}});
verifyOutput(out);
-out = db.srcNonSharded.mapReduce(map, reduce, { out: { reduce: "mrReduce" + suffix } });
+out = db.srcNonSharded.mapReduce(map, reduce, {out: {reduce: "mrReduce" + suffix}});
verifyOutput(out);
-out = db.srcNonSharded.mapReduce(map, reduce, { out: { inline: 1 }});
+out = db.srcNonSharded.mapReduce(map, reduce, {out: {inline: 1}});
verifyOutput(out);
assert(out.results != 'undefined', "no results for inline");
-out = db.srcNonSharded.mapReduce(map, reduce, { out: { replace: "mrReplace" + suffix, db: "mrShardOtherDB" } });
+out = db.srcNonSharded.mapReduce(
+ map, reduce, {out: {replace: "mrReplace" + suffix, db: "mrShardOtherDB"}});
verifyOutput(out);
out = db.runCommand({
- mapReduce: "srcNonSharded", // use new name mapReduce rather than mapreduce
+ mapReduce: "srcNonSharded", // use new name mapReduce rather than mapreduce
map: map,
reduce: reduce,
out: "mrBasic" + "srcNonSharded",
- });
+});
verifyOutput(out);