diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-02-17 09:38:03 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-02-17 09:38:03 -0500 |
commit | 873ab5b6664aef749e827428f47e779da1f9aad8 (patch) | |
tree | eb1ec8a7bda5e1fb3ba2365822e5ea5eba0bbb50 /shell/mongo.js | |
parent | 566af4dc73e74e2f0b5a566455d82319ec312537 (diff) | |
download | mongo-873ab5b6664aef749e827428f47e779da1f9aad8.tar.gz |
split out server stuff from mongo.js
Diffstat (limited to 'shell/mongo.js')
-rw-r--r-- | shell/mongo.js | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/shell/mongo.js b/shell/mongo.js index 350ca8381ca..50e8ae1aec5 100644 --- a/shell/mongo.js +++ b/shell/mongo.js @@ -63,63 +63,3 @@ connect = function( url , user , pass ){ return db; } - -_parsePath = function() { - var dbpath = ""; - for( var i = 0; i < arguments.length; ++i ) - if ( arguments[ i ] == "--dbpath" ) - dbpath = arguments[ i + 1 ]; - - if ( dbpath == "" ) - throw "No dbpath specified"; - - return dbpath; -} - -_parsePort = function() { - var port = ""; - for( var i = 0; i < arguments.length; ++i ) - if ( arguments[ i ] == "--port" ) - port = arguments[ i + 1 ]; - - if ( port == "" ) - throw "No port specified"; - return port; -} - -// Start a mongod instance and return a 'Mongo' object connected to it. -// This function's arguments are passed as command line arguments to mongod. -// The specified 'dbpath' is cleared if it exists, created if not. -startMongod = function() { - var dbpath = _parsePath.apply( null, arguments ); - resetDbpath( dbpath ); - var fullArgs = Array(); - fullArgs[ 0 ] = "mongod"; - for( i = 0; i < arguments.length; ++i ) - fullArgs[ i + 1 ] = arguments[ i ]; - return startMongoProgram.apply( null, fullArgs ); -} - -// Start a mongo program instance (generally mongod or mongos) and return a -// 'Mongo' object connected to it. This function's first argument is the -// program name, and subsequent arguments to this function are passed as -// command line arguments to the program. -startMongoProgram = function() { - var port = _parsePort.apply( null, arguments ); - - _startMongoProgram.apply( null, arguments ); - - var m; - assert.soon - ( function() { - try { - m = new Mongo( "127.0.0.1:" + port ); - return true; - } catch( e ) { - } - return false; - } ); - - return m; -} - |