diff options
author | dwight <dwight@10gen.com> | 2010-06-14 16:10:23 -0400 |
---|---|---|
committer | dwight <dwight@10gen.com> | 2010-06-14 16:10:23 -0400 |
commit | 93fdeab94380b526b60c8a4ff3f3f6a9a4fbf479 (patch) | |
tree | d8b0551fd00ebb27f4d982682cd90261f040c9ab | |
parent | 8a49ab1ce166a8e1a6d07efc1d064ea1e07c9993 (diff) | |
download | mongo-93fdeab94380b526b60c8a4ff3f3f6a9a4fbf479.tar.gz |
better err msg
-rw-r--r-- | db/db.vcxproj | 2 | ||||
-rwxr-xr-x | db/db.vcxproj.filters | 6 | ||||
-rw-r--r-- | jstests/rs/rs_basic.js | 4 | ||||
-rw-r--r-- | shell/collection.js | 76 | ||||
-rw-r--r-- | shell/query.js | 64 | ||||
-rw-r--r-- | shell/shell_utils.cpp | 13 |
6 files changed, 87 insertions, 78 deletions
diff --git a/db/db.vcxproj b/db/db.vcxproj index 863c1d7bb53..5c21052ee52 100644 --- a/db/db.vcxproj +++ b/db/db.vcxproj @@ -556,6 +556,8 @@ <ClCompile Include="repl\rs_config.cpp" />
</ItemGroup>
<ItemGroup>
+ <None Include="..\jstests\rs\rs_basic.js" />
+ <None Include="..\jstests\rs\test_framework.js" />
<None Include="..\SConstruct" />
<None Include="..\util\mongoutils\README" />
<None Include="mongo.ico" />
diff --git a/db/db.vcxproj.filters b/db/db.vcxproj.filters index c967ad619e2..0a0796b30fa 100755 --- a/db/db.vcxproj.filters +++ b/db/db.vcxproj.filters @@ -784,6 +784,12 @@ <None Include="..\SConstruct">
<Filter>db</Filter>
</None>
+ <None Include="..\jstests\rs\rs_basic.js">
+ <Filter>rs\test stuff</Filter>
+ </None>
+ <None Include="..\jstests\rs\test_framework.js">
+ <Filter>rs\test stuff</Filter>
+ </None>
</ItemGroup>
<ItemGroup>
<Library Include="..\..\js\js64r.lib">
diff --git a/jstests/rs/rs_basic.js b/jstests/rs/rs_basic.js index 3d133991dcc..8b0e3df6408 100644 --- a/jstests/rs/rs_basic.js +++ b/jstests/rs/rs_basic.js @@ -1,6 +1,6 @@ // rs_basic.js -load("test_framework.js"); +load("../../jstests/rs/test_framework.js"); function go() { a = rs_mongod(); @@ -136,7 +136,7 @@ block() assert.eq( { _id : "fun" , a : { b : { c : { x : 6848 , y : 911 } } } } , as.b.findOne() , "b 3" ); //printjson( t.findOne() ) //printjson( as.b.findOne() ) -//am.getSisterDB( "local" ).getCollection( "oplog.$main" ).find().sort( { $natural : -1 } ).limit(3).forEach( printjson )
+//am.getSisterDB( "local" ).getCollection( "oplog.$main" ).find().sort( { $natural : -1 } ).limit(3).forEach( printjson ) check("b 4"); rt.stop(); diff --git a/shell/collection.js b/shell/collection.js index eca3d378b7c..bdd8fe3027e 100644 --- a/shell/collection.js +++ b/shell/collection.js @@ -24,44 +24,44 @@ DBCollection.prototype.verify = function(){ DBCollection.prototype.getName = function(){ return this._shortName; -}
-
-DBCollection.prototype.help = function () {
- var shortName = this.getName();
- print("DBCollection help");
- print("\tdb." + shortName + ".find().help() - show DBCursor help");
- print("\tdb." + shortName + ".count()");
- print("\tdb." + shortName + ".dataSize()");
- print("\tdb." + shortName + ".distinct( key ) - eg. db." + shortName + ".distinct( 'x' )");
- print("\tdb." + shortName + ".drop() drop the collection");
- print("\tdb." + shortName + ".dropIndex(name)");
- print("\tdb." + shortName + ".dropIndexes()");
- print("\tdb." + shortName + ".ensureIndex(keypattern,options) - options should be an object with these possible fields: name, unique, dropDups");
- print("\tdb." + shortName + ".reIndex()");
- print("\tdb." + shortName + ".find( [query] , [fields]) - first parameter is an optional query filter. second parameter is optional set of fields to return.");
- print("\t e.g. db." + shortName + ".find( { x : 77 } , { name : 1 , x : 1 } )");
- print("\tdb." + shortName + ".find(...).count()");
- print("\tdb." + shortName + ".find(...).limit(n)");
- print("\tdb." + shortName + ".find(...).skip(n)");
- print("\tdb." + shortName + ".find(...).sort(...)");
- print("\tdb." + shortName + ".findOne([query])");
- print("\tdb." + shortName + ".findAndModify( { update : ... , remove : bool [, query: {}, sort: {}, 'new': false] } )");
- print("\tdb." + shortName + ".getDB() get DB object associated with collection");
- print("\tdb." + shortName + ".getIndexes()");
- print("\tdb." + shortName + ".group( { key : ..., initial: ..., reduce : ...[, cond: ...] } )");
- print("\tdb." + shortName + ".mapReduce( mapFunction , reduceFunction , <optional params> )");
- print("\tdb." + shortName + ".remove(query)");
- print("\tdb." + shortName + ".renameCollection( newName , <dropTarget> ) renames the collection.");
- print("\tdb." + shortName + ".runCommand( name , <options> ) runs a db command with the given name where the 1st param is the colleciton name");
- print("\tdb." + shortName + ".save(obj)");
- print("\tdb." + shortName + ".stats()");
- print("\tdb." + shortName + ".storageSize() - includes free space allocated to this collection");
- print("\tdb." + shortName + ".totalIndexSize() - size in bytes of all the indexes");
- print("\tdb." + shortName + ".totalSize() - storage allocated for all data and indexes");
- print("\tdb." + shortName + ".update(query, object[, upsert_bool, multi_bool])");
- print("\tdb." + shortName + ".validate() - SLOW");
- print("\tdb." + shortName + ".getShardVersion() - only for use with sharding");
- return __magicNoPrint;
+} + +DBCollection.prototype.help = function () { + var shortName = this.getName(); + print("DBCollection help"); + print("\tdb." + shortName + ".find().help() - show DBCursor help"); + print("\tdb." + shortName + ".count()"); + print("\tdb." + shortName + ".dataSize()"); + print("\tdb." + shortName + ".distinct( key ) - eg. db." + shortName + ".distinct( 'x' )"); + print("\tdb." + shortName + ".drop() drop the collection"); + print("\tdb." + shortName + ".dropIndex(name)"); + print("\tdb." + shortName + ".dropIndexes()"); + print("\tdb." + shortName + ".ensureIndex(keypattern,options) - options should be an object with these possible fields: name, unique, dropDups"); + print("\tdb." + shortName + ".reIndex()"); + print("\tdb." + shortName + ".find( [query] , [fields]) - first parameter is an optional query filter. second parameter is optional set of fields to return."); + print("\t e.g. db." + shortName + ".find( { x : 77 } , { name : 1 , x : 1 } )"); + print("\tdb." + shortName + ".find(...).count()"); + print("\tdb." + shortName + ".find(...).limit(n)"); + print("\tdb." + shortName + ".find(...).skip(n)"); + print("\tdb." + shortName + ".find(...).sort(...)"); + print("\tdb." + shortName + ".findOne([query])"); + print("\tdb." + shortName + ".findAndModify( { update : ... , remove : bool [, query: {}, sort: {}, 'new': false] } )"); + print("\tdb." + shortName + ".getDB() get DB object associated with collection"); + print("\tdb." + shortName + ".getIndexes()"); + print("\tdb." + shortName + ".group( { key : ..., initial: ..., reduce : ...[, cond: ...] } )"); + print("\tdb." + shortName + ".mapReduce( mapFunction , reduceFunction , <optional params> )"); + print("\tdb." + shortName + ".remove(query)"); + print("\tdb." + shortName + ".renameCollection( newName , <dropTarget> ) renames the collection."); + print("\tdb." + shortName + ".runCommand( name , <options> ) runs a db command with the given name where the 1st param is the colleciton name"); + print("\tdb." + shortName + ".save(obj)"); + print("\tdb." + shortName + ".stats()"); + print("\tdb." + shortName + ".storageSize() - includes free space allocated to this collection"); + print("\tdb." + shortName + ".totalIndexSize() - size in bytes of all the indexes"); + print("\tdb." + shortName + ".totalSize() - storage allocated for all data and indexes"); + print("\tdb." + shortName + ".update(query, object[, upsert_bool, multi_bool])"); + print("\tdb." + shortName + ".validate() - SLOW"); + print("\tdb." + shortName + ".getShardVersion() - only for use with sharding"); + return __magicNoPrint; } DBCollection.prototype.getFullName = function(){ diff --git a/shell/query.js b/shell/query.js index 8d5d65338ae..733d6a686b6 100644 --- a/shell/query.js +++ b/shell/query.js @@ -20,24 +20,24 @@ if ( typeof DBQuery == "undefined" ){ this._prettyShell = false; } print( "DBQuery probably won't have array access " ); -}
-
-DBQuery.prototype.help = function () {
- print("find() modifiers")
- print("\t.sort( {...} )")
- print("\t.limit( n )")
- print("\t.skip( n )")
- print("\t.count() - total # of objects matching query, ignores skip,limit")
- print("\t.size() - total # of objects cursor would return, honors skip,limit")
- print("\t.explain([verbose])")
- print("\t.hint(...)")
- print("\t.showDiskLoc() - adds a $diskLoc field to each returned object")
- print("\nCursor methods");
- print("\t.forEach( func )")
- print("\t.print() - output to console in full pretty format")
- print("\t.map( func )")
- print("\t.hasNext()")
- print("\t.next()")
+} + +DBQuery.prototype.help = function () { + print("find() modifiers") + print("\t.sort( {...} )") + print("\t.limit( n )") + print("\t.skip( n )") + print("\t.count() - total # of objects matching query, ignores skip,limit") + print("\t.size() - total # of objects cursor would return, honors skip,limit") + print("\t.explain([verbose])") + print("\t.hint(...)") + print("\t.showDiskLoc() - adds a $diskLoc field to each returned object") + print("\nCursor methods"); + print("\t.forEach( func )") + print("\t.print() - output to console in full pretty format") + print("\t.map( func )") + print("\t.hasNext()") + print("\t.next()") } DBQuery.prototype.clone = function(){ @@ -221,20 +221,20 @@ DBQuery.prototype.map = function( func ){ DBQuery.prototype.arrayAccess = function( idx ){ return this.toArray()[idx]; -}
-
-DBQuery.prototype.explain = function (verbose) {
- /* verbose=true --> include allPlans, oldPlan fields */
- var n = this.clone();
- n._ensureSpecial();
- n._query.$explain = true;
- n._limit = n._limit * -1;
- var e = n.next();
- if (!verbose) {
- delete e.allPlans;
- delete e.oldPlan;
- }
- return e;
+} + +DBQuery.prototype.explain = function (verbose) { + /* verbose=true --> include allPlans, oldPlan fields */ + var n = this.clone(); + n._ensureSpecial(); + n._query.$explain = true; + n._limit = n._limit * -1; + var e = n.next(); + if (!verbose) { + delete e.allPlans; + delete e.oldPlan; + } + return e; } DBQuery.prototype.snapshot = function(){ diff --git a/shell/shell_utils.cpp b/shell/shell_utils.cpp index 030a09fceaf..9748ae19049 100644 --- a/shell/shell_utils.cpp +++ b/shell/shell_utils.cpp @@ -261,7 +261,6 @@ namespace mongo { pid_t pid() const { return pid_; } boost::filesystem::path find(string prog) { - cout << "ELIOT [" << prog << "]" << endl; boost::filesystem::path p = prog; #ifdef _WIN32 p = change_extension(p, ".exe"); @@ -291,9 +290,7 @@ namespace mongo { boost::filesystem::path t = boost::filesystem::initial_path() / p; if( boost::filesystem::exists(t) ) return t; } - // this breaks system programs - // massert( 10435, (string)"run: couldn't find " + prog , false ); - return p; + return p; // not found; might find via system path } ProgramRunner( const BSONObj &args , bool isMongoProgram=true) @@ -445,7 +442,11 @@ namespace mongo { ZeroMemory(&pi, sizeof(pi)); bool success = CreateProcess( NULL, args_tchar.get(), NULL, NULL, true, 0, NULL, NULL, &si, &pi) != 0; - uassert(13294, "couldn't start process", success); + { + stringstream ss; + ss << "couldn't start process " << argv_[0]; + uassert(13294, ss.str(), success); + } CloseHandle(pi.hThread); @@ -475,7 +476,7 @@ namespace mongo { execvp( argv[ 0 ], const_cast<char**>(argv) ); - cout << "Unable to start program: " << errnoWithDescription() << endl; + cout << "Unable to start program " << argv[0] << ' ' << errnoWithDescription() << endl; ::_Exit(-1); } |