Permalink
Browse files

CS-1507: do print() instead of returning value, cleaner and works in …

…loop
  • Loading branch information...
1 parent a53f2a5 commit 47f28e90744aa3f116cf38a517d2213e4065da51 @agirbal agirbal committed Sep 29, 2011
Showing with 12 additions and 19 deletions.
  1. +0 −9 jstests/shell1.js
  2. +3 −3 shell/collection.js
  3. +3 −2 shell/db.js
  4. +6 −5 shell/mongo_vstudio.cpp
View
@@ -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();
View
@@ -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 ){
@@ -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 ){
@@ -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 ){
View
@@ -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 + " ";
@@ -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);
}
}
View
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"

0 comments on commit 47f28e9

Please sign in to comment.