diff options
author | Kamran Khan <kamran.khan@mongodb.com> | 2016-02-29 18:24:00 -0500 |
---|---|---|
committer | Kamran Khan <kamran.khan@mongodb.com> | 2016-02-29 18:24:00 -0500 |
commit | 8aeda03d357042d43d3ec8a05b5e033d879da018 (patch) | |
tree | 5df6fa4ce8a93fac706b24e7cf338b375c9c6b01 | |
parent | 76cc3b37b1912c35c80084b859efcdc93b104637 (diff) | |
download | mongo-8aeda03d357042d43d3ec8a05b5e033d879da018.tar.gz |
SERVER-22882 Remove the argumentsToArray function from the shell
The function is no longer necessary now that Array.from exists.
-rw-r--r-- | jstests/libs/parallelTester.js | 4 | ||||
-rw-r--r-- | src/mongo/shell/collection.js | 2 | ||||
-rw-r--r-- | src/mongo/shell/db.js | 2 | ||||
-rw-r--r-- | src/mongo/shell/explainable.js | 2 | ||||
-rwxr-xr-x | src/mongo/shell/servers.js | 6 | ||||
-rw-r--r-- | src/mongo/shell/types.js | 2 | ||||
-rw-r--r-- | src/mongo/shell/utils.js | 7 |
7 files changed, 9 insertions, 16 deletions
diff --git a/jstests/libs/parallelTester.js b/jstests/libs/parallelTester.js index 39035731449..0b230727cef 100644 --- a/jstests/libs/parallelTester.js +++ b/jstests/libs/parallelTester.js @@ -61,7 +61,7 @@ if (typeof _threadInject != "undefined") { }; EventGenerator.dispatch = function() { - var args = argumentsToArray( arguments ); + var args = Array.from(arguments); var me = args.shift(); var collectionName = args.shift(); var host = args.shift(); @@ -211,7 +211,7 @@ if (typeof _threadInject != "undefined") { // runs a set of test files // first argument is an identifier for this tester, remaining arguments are file names ParallelTester.fileTester = function() { - var args = argumentsToArray( arguments ); + var args = Array.from(arguments); var suite = args.shift(); args.forEach( function( x ) { diff --git a/src/mongo/shell/collection.js b/src/mongo/shell/collection.js index b23fd91d2d1..06d79385b4a 100644 --- a/src/mongo/shell/collection.js +++ b/src/mongo/shell/collection.js @@ -1140,7 +1140,7 @@ DBCollection.prototype.isCapped = function(){ DBCollection.prototype.aggregate = function(pipeline, aggregateOptions) { if (!(pipeline instanceof Array)) { // support legacy varargs form. (Also handles db.foo.aggregate()) - pipeline = argumentsToArray(arguments); + pipeline = Array.from(arguments); aggregateOptions = {}; } else if (aggregateOptions === undefined) { aggregateOptions = {}; diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js index 91892ff55e3..b4a5739c265 100644 --- a/src/mongo/shell/db.js +++ b/src/mongo/shell/db.js @@ -544,7 +544,7 @@ DB.prototype.eval = function(jsfunction) { var cmd = { $eval : jsfunction }; if ( arguments.length > 1 ) { - cmd.args = argumentsToArray( arguments ).slice(1); + cmd.args = Array.from(arguments).slice(1); } var res = this._dbCommand( cmd ); diff --git a/src/mongo/shell/explainable.js b/src/mongo/shell/explainable.js index 445ade758a6..b4fcf21020a 100644 --- a/src/mongo/shell/explainable.js +++ b/src/mongo/shell/explainable.js @@ -103,7 +103,7 @@ var Explainable = (function() { this.aggregate = function(pipeline, extraOpts) { if (!(pipeline instanceof Array)) { // support legacy varargs form. (Also handles db.foo.aggregate()) - pipeline = argumentsToArray(arguments); + pipeline = Array.from(arguments); extraOpts = {}; } diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js index fadc5f4d876..5b0a8a9a026 100755 --- a/src/mongo/shell/servers.js +++ b/src/mongo/shell/servers.js @@ -952,7 +952,7 @@ startMongoProgram = function(){ // Enable test commands. // TODO: Make this work better with multi-version testing so that we can support // enabling this on 2.4 when testing 2.6 - var args = argumentsToArray( arguments ); + var args = Array.from(arguments); args = appendSetParameterArgs(args); var pid = _startMongoProgram.apply( null, args ); @@ -979,7 +979,7 @@ startMongoProgram = function(){ }; runMongoProgram = function() { - var args = argumentsToArray( arguments ); + var args = Array.from(arguments); args = appendSetParameterArgs(args); var progName = args[0]; @@ -1005,7 +1005,7 @@ runMongoProgram = function() { // program name, and subsequent arguments to this function are passed as // command line arguments to the program. Returns pid of the spawned program. startMongoProgramNoConnect = function() { - var args = argumentsToArray( arguments ); + var args = Array.from(arguments); args = appendSetParameterArgs(args); var progName = args[0]; diff --git a/src/mongo/shell/types.js b/src/mongo/shell/types.js index 2daaddbc510..c93e68fbcbe 100644 --- a/src/mongo/shell/types.js +++ b/src/mongo/shell/types.js @@ -24,7 +24,7 @@ Date.timeFunc = function(theFunc, numTimes){ var start = new Date(); numTimes = numTimes || 1; for (var i=0; i<numTimes; i++){ - theFunc.apply(null, argumentsToArray(arguments).slice(2)); + theFunc.apply(null, Array.from(arguments).slice(2)); } return (new Date()).getTime() - start.getTime(); diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js index d5f5932d453..594bcfb97da 100644 --- a/src/mongo/shell/utils.js +++ b/src/mongo/shell/utils.js @@ -78,13 +78,6 @@ setVerboseShell = function( value ) { _verboseShell = value; }; -argumentsToArray = function( a ){ - var arr = []; - for ( var i=0; i<a.length; i++ ) - arr[i] = a[i]; - return arr; -}; - // Formats a simple stacked horizontal histogram bar in the shell. // @param data array of the form [[ratio, symbol], ...] where ratio is between 0 and 1 and // symbol is a string of length 1 |