summaryrefslogtreecommitdiff
path: root/src/mongo/shell/servers_misc.js
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2015-04-24 14:45:25 -0400
committerSpencer T Brody <spencer@mongodb.com>2015-04-24 17:29:05 -0400
commit9ad121c1653c73b73a099e5efd26953859734483 (patch)
tree643cbcfdf1462397bd0f545b6af47c55ea460f3a /src/mongo/shell/servers_misc.js
parent9cf89ce4f44f3885e5bea05c31d5a40cd86c4b4c (diff)
downloadmongo-9ad121c1653c73b73a099e5efd26953859734483.tar.gz
SERVER-18201 Make sure js code is the last argument to mongo shell in startParallelShell
Diffstat (limited to 'src/mongo/shell/servers_misc.js')
-rw-r--r--src/mongo/shell/servers_misc.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/mongo/shell/servers_misc.js b/src/mongo/shell/servers_misc.js
index ec3fe887f4d..46df568dc28 100644
--- a/src/mongo/shell/servers_misc.js
+++ b/src/mongo/shell/servers_misc.js
@@ -221,6 +221,18 @@ function startParallelShell( jsCode, port, noConnect ){
var args = ["mongo"];
+ if (typeof db == "object") {
+ var hostAndPort = db.getMongo().host.split(':');
+ var host = hostAndPort[0];
+ args.push("--host", host);
+ if (!port && hostAndPort.length >= 2) {
+ var port = hostAndPort[1];
+ }
+ }
+ if (port) {
+ args.push("--port", port);
+ }
+
// Convert function into call-string
if (typeof(jsCode) == "function") {
var id = Math.floor(Math.random() * 100000);
@@ -244,18 +256,6 @@ function startParallelShell( jsCode, port, noConnect ){
args.push("--eval", jsCode);
- if (typeof db == "object") {
- var hostAndPort = db.getMongo().host.split(':');
- var host = hostAndPort[0];
- args.push("--host", host);
- if (!port && hostAndPort.length >= 2) {
- var port = hostAndPort[1];
- }
- }
- if (port) {
- args.push("--port", port);
- }
-
x = startMongoProgramNoConnect.apply(null, args);
return function(){
return waitProgram( x );