Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
CS-1507: do print() instead of returning value, cleaner and works in …
…loop
  • Loading branch information
agirbal committed Sep 29, 2011
1 parent a53f2a5 commit 47f28e9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
9 changes: 0 additions & 9 deletions jstests/shell1.js
Expand Up @@ -4,15 +4,6 @@ shellHelper( "show", "tables;" )
shellHelper( "show", "tables" )
shellHelper( "show", "tables ;" )

// test verbose shell option
setVerboseShell();
var res = db.test.remove({a:1});
var res2 = db.test.update({a:1}, {b: 1});
assert(res != undefined && res2 != undefined, "verbose shell 1")
setVerboseShell(false);
var res = db.test.remove({a:1});
assert(res == undefined, "verbose shell 2")

// test slaveOk levels
assert(!db.getSlaveOk() && !db.test.getSlaveOk() && !db.getMongo().getSlaveOk(), "slaveOk 1");
db.getMongo().setSlaveOk();
Expand Down
6 changes: 3 additions & 3 deletions shell/collection.js
Expand Up @@ -175,7 +175,7 @@ DBCollection.prototype.insert = function( obj , _allow_dot ){
this._db._initExtraInfo();
this._mongo.insert( this._fullName , obj );
this._lastID = obj._id;
return this._db._getExtraInfo("Inserted");
this._db._getExtraInfo("Inserted");
}

DBCollection.prototype.remove = function( t , justOne ){
Expand All @@ -186,7 +186,7 @@ DBCollection.prototype.remove = function( t , justOne ){
}
this._db._initExtraInfo();
this._mongo.remove( this._fullName , this._massageObject( t ) , justOne ? true : false );
return this._db._getExtraInfo("Removed");
this._db._getExtraInfo("Removed");
}

DBCollection.prototype.update = function( query , obj , upsert , multi ){
Expand All @@ -205,7 +205,7 @@ DBCollection.prototype.update = function( query , obj , upsert , multi ){
}
this._db._initExtraInfo();
this._mongo.update( this._fullName , query , obj , upsert ? true : false , multi ? true : false );
return this._db._getExtraInfo("Updated");
this._db._getExtraInfo("Updated");
}

DBCollection.prototype.save = function( obj ){
Expand Down
5 changes: 3 additions & 2 deletions shell/db.js
Expand Up @@ -400,7 +400,8 @@ DB.prototype._getExtraInfo = function(action) {
if (res) {
if (res.err != undefined && res.err != null) {
// error occured, display it
return res.err;
print(res.err);
return;
}

var info = action + " ";
Expand All @@ -410,7 +411,7 @@ DB.prototype._getExtraInfo = function(action) {
info += " record(s)";
var time = new Date().getTime() - this.startTime;
info += " in " + time + "ms";
return info;
print(info);
}
}

Expand Down
11 changes: 6 additions & 5 deletions shell/mongo_vstudio.cpp
Expand Up @@ -2251,7 +2251,8 @@ const StringData _jscode_raw_db =
"if (res) {\n"
"if (res.err != undefined && res.err != null) {\n"
"// error occured, display it\n"
"return res.err;\n"
"print(res.err);\n"
"return;\n"
"}\n"
"\n"
"var info = action + \" \";\n"
Expand All @@ -2261,7 +2262,7 @@ const StringData _jscode_raw_db =
"info += \" record(s)\";\n"
"var time = new Date().getTime() - this.startTime;\n"
"info += \" in \" + time + \"ms\";\n"
"return info;\n"
"print(info);\n"
"}\n"
"}\n"
"\n"
Expand Down Expand Up @@ -3425,7 +3426,7 @@ const StringData _jscode_raw_collection =
"this._db._initExtraInfo();\n"
"this._mongo.insert( this._fullName , obj );\n"
"this._lastID = obj._id;\n"
"return this._db._getExtraInfo(\"Inserted\");\n"
"this._db._getExtraInfo(\"Inserted\");\n"
"}\n"
"\n"
"DBCollection.prototype.remove = function( t , justOne ){\n"
Expand All @@ -3436,7 +3437,7 @@ const StringData _jscode_raw_collection =
"}\n"
"this._db._initExtraInfo();\n"
"this._mongo.remove( this._fullName , this._massageObject( t ) , justOne ? true : false );\n"
"return this._db._getExtraInfo(\"Removed\");\n"
"this._db._getExtraInfo(\"Removed\");\n"
"}\n"
"\n"
"DBCollection.prototype.update = function( query , obj , upsert , multi ){\n"
Expand All @@ -3455,7 +3456,7 @@ const StringData _jscode_raw_collection =
"}\n"
"this._db._initExtraInfo();\n"
"this._mongo.update( this._fullName , query , obj , upsert ? true : false , multi ? true : false );\n"
"return this._db._getExtraInfo(\"Updated\");\n"
"this._db._getExtraInfo(\"Updated\");\n"
"}\n"
"\n"
"DBCollection.prototype.save = function( obj ){\n"
Expand Down

0 comments on commit 47f28e9

Please sign in to comment.