diff options
Diffstat (limited to 'src/mongo/shell/servers_misc.js')
-rw-r--r-- | src/mongo/shell/servers_misc.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/shell/servers_misc.js b/src/mongo/shell/servers_misc.js index 91db127998a..52a2f3a9381 100644 --- a/src/mongo/shell/servers_misc.js +++ b/src/mongo/shell/servers_misc.js @@ -290,6 +290,17 @@ function startParallelShell( jsCode, port, noConnect ){ var args = ["mongo"]; + // Convert function into call-string + if (typeof(jsCode) == "function") { + var id = Math.floor(Math.random() * 100000); + jsCode = "var f" + id + " = " + jsCode.toString() + ";f" + id + "();"; + } + else if(typeof(jsCode) == "string") {} + // do nothing + else { + throw Error("bad first argument to startParallelShell"); + } + if (noConnect) { args.push("--nodb"); } else if (typeof(db) == "object") { |