summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthroughWithMongod')
-rw-r--r--jstests/noPassthroughWithMongod/apply_ops_errors.js7
-rw-r--r--jstests/noPassthroughWithMongod/bench_test_crud_commands.js15
-rw-r--r--jstests/noPassthroughWithMongod/clonecollection.js10
-rw-r--r--jstests/noPassthroughWithMongod/commands_that_write_accept_wc_standalone.js9
-rw-r--r--jstests/noPassthroughWithMongod/create_indexes_shell_helper.js8
-rw-r--r--jstests/noPassthroughWithMongod/external_sort_text_agg.js13
-rw-r--r--jstests/noPassthroughWithMongod/ftdc_params.js4
-rw-r--r--jstests/noPassthroughWithMongod/geo_axis_aligned.js23
-rw-r--r--jstests/noPassthroughWithMongod/geo_polygon.js19
-rw-r--r--jstests/noPassthroughWithMongod/index_check10.js4
-rw-r--r--jstests/noPassthroughWithMongod/index_check9.js4
-rw-r--r--jstests/noPassthroughWithMongod/index_multi.js8
-rw-r--r--jstests/noPassthroughWithMongod/indexbg_drop.js5
-rw-r--r--jstests/noPassthroughWithMongod/indexbg_updates.js9
-rw-r--r--jstests/noPassthroughWithMongod/insertMulti.js4
-rw-r--r--jstests/noPassthroughWithMongod/mr_writeconflict.js6
-rw-r--r--jstests/noPassthroughWithMongod/replReads.js5
-rw-r--r--jstests/noPassthroughWithMongod/rpc_protocols.js52
-rw-r--r--jstests/noPassthroughWithMongod/temp_namespace.js8
19 files changed, 81 insertions, 132 deletions
diff --git a/jstests/noPassthroughWithMongod/apply_ops_errors.js b/jstests/noPassthroughWithMongod/apply_ops_errors.js
index 31353523810..d2f584af787 100644
--- a/jstests/noPassthroughWithMongod/apply_ops_errors.js
+++ b/jstests/noPassthroughWithMongod/apply_ops_errors.js
@@ -22,8 +22,11 @@
coll.ensureIndex({x: 1}, {unique: true});
coll.insert({_id: 1, x: "init"});
- var res =
- db.runCommand({applyOps: [{op: "i", ns: coll.getFullName(), o: {_id: 2, x: "init"}}, ]});
+ var res = db.runCommand({
+ applyOps: [
+ {op: "i", ns: coll.getFullName(), o: {_id: 2, x: "init"}},
+ ]
+ });
assert.eq(1, res.applied);
assert(res.code);
diff --git a/jstests/noPassthroughWithMongod/bench_test_crud_commands.js b/jstests/noPassthroughWithMongod/bench_test_crud_commands.js
index 14ee7d0fdb7..7bbafa4e931 100644
--- a/jstests/noPassthroughWithMongod/bench_test_crud_commands.js
+++ b/jstests/noPassthroughWithMongod/bench_test_crud_commands.js
@@ -7,9 +7,7 @@
assert.commandWorked(coll.getDB().createCollection(coll.getName()));
function makeDocument(docSize) {
- var doc = {
- "fieldName": ""
- };
+ var doc = {"fieldName": ""};
var longString = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
while (Object.bsonsize(doc) < docSize) {
if (Object.bsonsize(doc) < docSize - longString.length) {
@@ -22,12 +20,7 @@
}
function executeBenchRun(benchOps) {
- var benchArgs = {
- ops: benchOps,
- parallel: 2,
- seconds: 1,
- host: db.getMongo().host
- };
+ var benchArgs = {ops: benchOps, parallel: 2, seconds: 1, host: db.getMongo().host};
if (jsTest.options().auth) {
benchArgs['db'] = 'admin';
benchArgs['username'] = jsTest.options().adminUser;
@@ -73,8 +66,8 @@
assert.writeOK(coll.insert({}));
}
- var res = executeBenchRun(
- [{ns: coll.getFullName(), op: "findOne", query: {}, readCmd: readCmd}]);
+ var res =
+ executeBenchRun([{ns: coll.getFullName(), op: "findOne", query: {}, readCmd: readCmd}]);
assert.gt(res.findOne, 0, tojson(res));
}
diff --git a/jstests/noPassthroughWithMongod/clonecollection.js b/jstests/noPassthroughWithMongod/clonecollection.js
index a3633a12e58..2f0ec45ad44 100644
--- a/jstests/noPassthroughWithMongod/clonecollection.js
+++ b/jstests/noPassthroughWithMongod/clonecollection.js
@@ -16,9 +16,8 @@ assert.eq(1000, t.a.find().count(), "A2");
t.a.drop();
-assert.commandWorked(t.cloneCollection("localhost:" + fromMongod.port,
- "a",
- {i: {$gte: 10, $lt: 20}}));
+assert.commandWorked(
+ t.cloneCollection("localhost:" + fromMongod.port, "a", {i: {$gte: 10, $lt: 20}}));
assert.eq(10, t.a.find().count(), "A3");
t.a.drop();
@@ -35,9 +34,8 @@ assert.eq(2, t.a.getIndexes().length, "expected index missing");
x = t.a.find({i: 50}).hint({i: 1}).explain("executionStats");
printjson(x);
assert.eq(1, x.executionStats.nReturned, "verify 1");
-assert.eq(1,
- t.a.find({i: 50}).hint({i: 1}).toArray().length,
- "match length did not match expected");
+assert.eq(
+ 1, t.a.find({i: 50}).hint({i: 1}).toArray().length, "match length did not match expected");
// Check that capped-ness is preserved on clone
f.a.drop();
diff --git a/jstests/noPassthroughWithMongod/commands_that_write_accept_wc_standalone.js b/jstests/noPassthroughWithMongod/commands_that_write_accept_wc_standalone.js
index 20b6501c459..22617b681c2 100644
--- a/jstests/noPassthroughWithMongod/commands_that_write_accept_wc_standalone.js
+++ b/jstests/noPassthroughWithMongod/commands_that_write_accept_wc_standalone.js
@@ -82,9 +82,7 @@
});
},
reduce: function(key, values) {
- return {
- count: values.length
- };
+ return {count: values.length};
},
out: "foo"
},
@@ -103,10 +101,7 @@
});
function testValidWriteConcern(cmd) {
- cmd.req.writeConcern = {
- w: 1,
- j: true
- };
+ cmd.req.writeConcern = {w: 1, j: true};
jsTest.log("Testing " + tojson(cmd.req));
coll.drop();
diff --git a/jstests/noPassthroughWithMongod/create_indexes_shell_helper.js b/jstests/noPassthroughWithMongod/create_indexes_shell_helper.js
index f9f9f7b9f06..bca0cd05f54 100644
--- a/jstests/noPassthroughWithMongod/create_indexes_shell_helper.js
+++ b/jstests/noPassthroughWithMongod/create_indexes_shell_helper.js
@@ -20,15 +20,11 @@
},
runCommand: function(db, cmd, opts) {
commandsRan.push({db: db, cmd: cmd, opts: opts});
- return {
- ok: 1.0
- };
+ return {ok: 1.0};
},
insert: function(db, indexSpecs, opts) {
insertsRan.push({db: db, indexSpecs: indexSpecs, opts: opts});
- return {
- ok: 1.0
- };
+ return {ok: 1.0};
},
getWriteConcern: function() {
return null;
diff --git a/jstests/noPassthroughWithMongod/external_sort_text_agg.js b/jstests/noPassthroughWithMongod/external_sort_text_agg.js
index ecb843ae9e5..b08a7c79a44 100644
--- a/jstests/noPassthroughWithMongod/external_sort_text_agg.js
+++ b/jstests/noPassthroughWithMongod/external_sort_text_agg.js
@@ -8,12 +8,13 @@ for (i = 0; i < 100; i++) {
}
var score = t.find({$text: {$search: "asdf"}}, {score: {$meta: 'textScore'}}).next().score;
-var res = t.aggregate([
- {$match: {$text: {$search: "asdf"}}},
- {$sort: {"_id": 1}},
- {$project: {string: "$text", score: {$meta: "textScore"}}}
-],
- {allowDiskUse: true});
+var res = t.aggregate(
+ [
+ {$match: {$text: {$search: "asdf"}}},
+ {$sort: {"_id": 1}},
+ {$project: {string: "$text", score: {$meta: "textScore"}}}
+ ],
+ {allowDiskUse: true});
// we must use .next() rather than a $limit because a $limit will optimize away the external sort
printjson(res.next());
assert.eq(res.next().score, score);
diff --git a/jstests/noPassthroughWithMongod/ftdc_params.js b/jstests/noPassthroughWithMongod/ftdc_params.js
index 5fae9e77c49..732af83f7d6 100644
--- a/jstests/noPassthroughWithMongod/ftdc_params.js
+++ b/jstests/noPassthroughWithMongod/ftdc_params.js
@@ -7,9 +7,7 @@
// Check the defaults are correct
//
function getparam(field) {
- var q = {
- getParameter: 1
- };
+ var q = {getParameter: 1};
q[field] = 1;
var ret = admin.runCommand(q);
diff --git a/jstests/noPassthroughWithMongod/geo_axis_aligned.js b/jstests/noPassthroughWithMongod/geo_axis_aligned.js
index 47c0369e5e0..5e08a6c1739 100644
--- a/jstests/noPassthroughWithMongod/geo_axis_aligned.js
+++ b/jstests/noPassthroughWithMongod/geo_axis_aligned.js
@@ -98,18 +98,17 @@ for (var b = 0; b < bits.length; b++) {
assert.gte(a[k].dis, distance);
}
- r = t.find(
- {
- loc: {
- $within: {
- $box: [
- [center[j][0] - radius[i], center[j][1] - radius[i]],
- [center[j][0] + radius[i], center[j][1] + radius[i]]
- ]
- }
- }
- },
- {_id: 1});
+ r = t.find({
+ loc: {
+ $within: {
+ $box: [
+ [center[j][0] - radius[i], center[j][1] - radius[i]],
+ [center[j][0] + radius[i], center[j][1] + radius[i]]
+ ]
+ }
+ }
+ },
+ {_id: 1});
assert.eq(9, r.count());
}
}
diff --git a/jstests/noPassthroughWithMongod/geo_polygon.js b/jstests/noPassthroughWithMongod/geo_polygon.js
index 073ffdeb72d..d2b271c32d7 100644
--- a/jstests/noPassthroughWithMongod/geo_polygon.js
+++ b/jstests/noPassthroughWithMongod/geo_polygon.js
@@ -5,10 +5,7 @@ num = 0;
var bulk = t.initializeUnorderedBulkOp();
for (x = -180; x < 180; x += .5) {
for (y = -180; y < 180; y += .5) {
- o = {
- _id: num++,
- loc: [x, y]
- };
+ o = {_id: num++, loc: [x, y]};
bulk.insert(o);
}
}
@@ -27,8 +24,8 @@ for (var n = 0; n < numTests; n++) {
assert.eq(
num,
t.find({
- loc: {"$within": {"$polygon": [[-180, -180], [-180, 180], [180, 180], [180, -180]]}}
- }).count(),
+ loc: {"$within": {"$polygon": [[-180, -180], [-180, 180], [180, 180], [180, -180]]}}
+ }).count(),
"Bounding Box Test");
assert.eq(
@@ -44,15 +41,17 @@ for (var n = 0; n < numTests; n++) {
// slope falls.
assert.between(
341 - 18,
- t.find({loc: {"$within": {"$polygon": [[0, 0], [0, 10], [10, 10], [10, 0], [5, 5]]}}})
- .count(),
+ t.find({
+ loc: {"$within": {"$polygon": [[0, 0], [0, 10], [10, 10], [10, 0], [5, 5]]}}
+ }).count(),
341,
"Square Missing Chunk Test",
true);
assert.between(
21 - 2,
- t.find({loc: {"$within": {"$polygon": [[0, 0], [0, 2], [2, 2], [2, 0], [1, 1]]}}})
- .count(),
+ t.find({
+ loc: {"$within": {"$polygon": [[0, 0], [0, 2], [2, 2], [2, 0], [1, 1]]}}
+ }).count(),
21,
"Square Missing Chunk Test 2",
true);
diff --git a/jstests/noPassthroughWithMongod/index_check10.js b/jstests/noPassthroughWithMongod/index_check10.js
index 30ed9c17eac..2816eecdb4b 100644
--- a/jstests/noPassthroughWithMongod/index_check10.js
+++ b/jstests/noPassthroughWithMongod/index_check10.js
@@ -69,9 +69,7 @@ function doIt() {
for (var j = 0; j < Random.randInt(15); ++j) {
vals.push(r());
}
- spec[fields[i]] = {
- $in: vals
- };
+ spec[fields[i]] = {$in: vals};
}
}
s = sort();
diff --git a/jstests/noPassthroughWithMongod/index_check9.js b/jstests/noPassthroughWithMongod/index_check9.js
index a801b473a44..fe158efbdad 100644
--- a/jstests/noPassthroughWithMongod/index_check9.js
+++ b/jstests/noPassthroughWithMongod/index_check9.js
@@ -83,9 +83,7 @@ function doIt() {
for (var j = 0; j < inLength; ++j) {
vals.push(r(alphas[i]));
}
- spec[fields[i]] = {
- $in: vals
- };
+ spec[fields[i]] = {$in: vals};
break;
}
case 2 /* equality */: {
diff --git a/jstests/noPassthroughWithMongod/index_multi.js b/jstests/noPassthroughWithMongod/index_multi.js
index 68004f27678..a09b20fee96 100644
--- a/jstests/noPassthroughWithMongod/index_multi.js
+++ b/jstests/noPassthroughWithMongod/index_multi.js
@@ -9,9 +9,7 @@ db.results.drop();
var bulk = coll.initializeUnorderedBulkOp();
print("Populate the collection with random data");
for (var i = 0; i < 1e4; i++) {
- var doc = {
- "_id": i
- };
+ var doc = {"_id": i};
for (var j = 0; j < 100; j++) {
// Skip some of the fields
@@ -89,9 +87,7 @@ for (var i = 0; i < 30; i++) {
print("Do some sets and unsets");
bulk = coll.initializeUnorderedBulkOp();
for (i = 0; i < 1e4; i++) {
- var criteria = {
- _id: Random.randInt(1e5)
- };
+ var criteria = {_id: Random.randInt(1e5)};
var mod = {};
if (Random.rand() < .5) {
mod['$set'] = {};
diff --git a/jstests/noPassthroughWithMongod/indexbg_drop.js b/jstests/noPassthroughWithMongod/indexbg_drop.js
index df66d82aaeb..74722b0e631 100644
--- a/jstests/noPassthroughWithMongod/indexbg_drop.js
+++ b/jstests/noPassthroughWithMongod/indexbg_drop.js
@@ -39,10 +39,7 @@ var secondId = replTest.getNodeId(second);
var masterDB = master.getDB(dbname);
var secondDB = second.getDB(dbname);
-var dc = {
- dropIndexes: collection,
- index: "i_1"
-};
+var dc = {dropIndexes: collection, index: "i_1"};
// set up collections
masterDB.dropDatabase();
diff --git a/jstests/noPassthroughWithMongod/indexbg_updates.js b/jstests/noPassthroughWithMongod/indexbg_updates.js
index a660ffc6eeb..c3465f78047 100644
--- a/jstests/noPassthroughWithMongod/indexbg_updates.js
+++ b/jstests/noPassthroughWithMongod/indexbg_updates.js
@@ -15,10 +15,7 @@
var bulk = coll.initializeUnorderedBulkOp();
print("Populate the collection with random data");
for (var i = 0; i < numDocs; i++) {
- var doc = {
- "_id": i,
- "field0": Random.rand()
- };
+ var doc = {"_id": i, "field0": Random.rand()};
bulk.insert(doc);
}
@@ -28,9 +25,7 @@
// field being actively indexed in the background
bulk = coll.initializeUnorderedBulkOp();
for (i = 0; i < numDocs; i++) {
- var criteria = {
- "_id": 1000
- };
+ var criteria = {"_id": 1000};
var mod = {};
if (Random.rand() < .8) {
diff --git a/jstests/noPassthroughWithMongod/insertMulti.js b/jstests/noPassthroughWithMongod/insertMulti.js
index e2a70307550..2d6fb3a9df4 100644
--- a/jstests/noPassthroughWithMongod/insertMulti.js
+++ b/jstests/noPassthroughWithMongod/insertMulti.js
@@ -4,9 +4,7 @@
"use strict";
function makeDocument(docSize) {
- var doc = {
- "fieldName": ""
- };
+ var doc = {"fieldName": ""};
var longString = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
while (Object.bsonsize(doc) < docSize) {
if (Object.bsonsize(doc) < docSize - longString.length) {
diff --git a/jstests/noPassthroughWithMongod/mr_writeconflict.js b/jstests/noPassthroughWithMongod/mr_writeconflict.js
index baae608b59e..4afabfb0143 100644
--- a/jstests/noPassthroughWithMongod/mr_writeconflict.js
+++ b/jstests/noPassthroughWithMongod/mr_writeconflict.js
@@ -5,11 +5,7 @@
load('jstests/libs/parallelTester.js');
var makeDoc = function(keyLimit, valueLimit) {
- return {
- _id: ObjectId(),
- key: Random.randInt(keyLimit),
- value: Random.randInt(valueLimit)
- };
+ return {_id: ObjectId(), key: Random.randInt(keyLimit), value: Random.randInt(valueLimit)};
};
var main = function() {
diff --git a/jstests/noPassthroughWithMongod/replReads.js b/jstests/noPassthroughWithMongod/replReads.js
index 45e0a4d49a6..3010be8e80c 100644
--- a/jstests/noPassthroughWithMongod/replReads.js
+++ b/jstests/noPassthroughWithMongod/replReads.js
@@ -56,10 +56,7 @@ function testReadLoadBalancing(numReplicas) {
connections.push(conn);
}
- var profileCriteria = {
- op: 'query',
- ns: 'test.foo'
- };
+ var profileCriteria = {op: 'query', ns: 'test.foo'};
for (var i = 0; i < secondaries.length; i++) {
var profileCollection = secondaries[i].getDB('test').system.profile;
diff --git a/jstests/noPassthroughWithMongod/rpc_protocols.js b/jstests/noPassthroughWithMongod/rpc_protocols.js
index 7e33c3986d3..9650d57e421 100644
--- a/jstests/noPassthroughWithMongod/rpc_protocols.js
+++ b/jstests/noPassthroughWithMongod/rpc_protocols.js
@@ -4,10 +4,7 @@
// startup using the "--rpcProtocols" command line option, or at runtime using the
// "setClientRPCProtocols" method on the Mongo object.
-var RPC_PROTOCOLS = {
- OP_QUERY: "opQueryOnly",
- OP_COMMAND: "opCommandOnly"
-};
+var RPC_PROTOCOLS = {OP_QUERY: "opQueryOnly", OP_COMMAND: "opCommandOnly"};
(function() {
"use strict";
@@ -28,50 +25,43 @@ var RPC_PROTOCOLS = {
}
// Test that --rpcProtocols=opQueryOnly forces OP_QUERY commands.
- runInShell(
- RPC_PROTOCOLS.OP_QUERY,
- function() {
- assert(db.getMongo().getClientRPCProtocols() === "opQueryOnly");
- db.getSiblingDB("test").rpcProtocols.find().comment("opQueryCommandLine").itcount();
- });
+ runInShell(RPC_PROTOCOLS.OP_QUERY, function() {
+ assert(db.getMongo().getClientRPCProtocols() === "opQueryOnly");
+ db.getSiblingDB("test").rpcProtocols.find().comment("opQueryCommandLine").itcount();
+ });
var profileDoc = db.system.profile.findOne({"query.comment": "opQueryCommandLine"});
assert(profileDoc !== null);
assert.eq(profileDoc.protocol, "op_query");
// Test that --rpcProtocols=opCommandOnly forces OP_COMMAND commands.
- runInShell(
- RPC_PROTOCOLS.OP_COMMAND,
- function() {
- assert(db.getMongo().getClientRPCProtocols() === "opCommandOnly");
- db.getSiblingDB("test").rpcProtocols.find().comment("opCommandCommandLine").itcount();
- });
+ runInShell(RPC_PROTOCOLS.OP_COMMAND, function() {
+ assert(db.getMongo().getClientRPCProtocols() === "opCommandOnly");
+ db.getSiblingDB("test").rpcProtocols.find().comment("opCommandCommandLine").itcount();
+ });
profileDoc = db.system.profile.findOne({"query.comment": "opCommandCommandLine"});
assert(profileDoc !== null);
assert.eq(profileDoc.protocol, "op_command");
// Test that .setClientRPCProtocols("opQueryOnly") forces OP_QUERY commands. We start the shell
// in OP_COMMAND only mode, then switch it to OP_QUERY mode at runtime.
- runInShell(RPC_PROTOCOLS.OP_COMMAND,
- function() {
- assert(db.getMongo().getClientRPCProtocols() === "opCommandOnly");
- db.getMongo().setClientRPCProtocols("opQueryOnly");
- assert(db.getMongo().getClientRPCProtocols() === "opQueryOnly");
- db.getSiblingDB("test").rpcProtocols.find().comment("opQueryRuntime").itcount();
- });
+ runInShell(RPC_PROTOCOLS.OP_COMMAND, function() {
+ assert(db.getMongo().getClientRPCProtocols() === "opCommandOnly");
+ db.getMongo().setClientRPCProtocols("opQueryOnly");
+ assert(db.getMongo().getClientRPCProtocols() === "opQueryOnly");
+ db.getSiblingDB("test").rpcProtocols.find().comment("opQueryRuntime").itcount();
+ });
profileDoc = db.system.profile.findOne({"query.comment": "opQueryRuntime"});
assert(profileDoc !== null);
assert.eq(profileDoc.protocol, "op_query");
// Test that .setClientRPCProtocols("opCommandOnly") forces OP_COMMAND commands. We start the
// shell in OP_QUERY only mode, then switch it to OP_COMMAND mode at runtime.
- runInShell(
- RPC_PROTOCOLS.OP_QUERY,
- function() {
- assert(db.getMongo().getClientRPCProtocols() === "opQueryOnly");
- db.getMongo().setClientRPCProtocols("opCommandOnly");
- assert(db.getMongo().getClientRPCProtocols() === "opCommandOnly");
- db.getSiblingDB("test").rpcProtocols.find().comment("opCommandRuntime").itcount();
- });
+ runInShell(RPC_PROTOCOLS.OP_QUERY, function() {
+ assert(db.getMongo().getClientRPCProtocols() === "opQueryOnly");
+ db.getMongo().setClientRPCProtocols("opCommandOnly");
+ assert(db.getMongo().getClientRPCProtocols() === "opCommandOnly");
+ db.getSiblingDB("test").rpcProtocols.find().comment("opCommandRuntime").itcount();
+ });
profileDoc = db.system.profile.findOne({"query.comment": "opCommandRuntime"});
assert(profileDoc !== null);
assert.eq(profileDoc.protocol, "op_command");
diff --git a/jstests/noPassthroughWithMongod/temp_namespace.js b/jstests/noPassthroughWithMongod/temp_namespace.js
index a2f1aa21a80..d84dcb302f3 100644
--- a/jstests/noPassthroughWithMongod/temp_namespace.js
+++ b/jstests/noPassthroughWithMongod/temp_namespace.js
@@ -17,9 +17,11 @@ d.runCommand({create: testname + 'keep3'});
d[testname + 'keep4'].insert({});
function countCollectionNames(theDB, regex) {
- return theDB.getCollectionNames().filter(function(z) {
- return z.match(regex);
- }).length;
+ return theDB.getCollectionNames()
+ .filter(function(z) {
+ return z.match(regex);
+ })
+ .length;
}
assert.eq(countCollectionNames(d, /temp\d$/), 2);