Permalink
Browse files

db.logout() command

  • Loading branch information...
1 parent 403b7aa commit 5798ea831b53e4c303c57cb14e72406a789fc86a @erh erh committed Jun 22, 2011
Showing with 18 additions and 2 deletions.
  1. +5 −1 jstests/auth2.js
  2. +5 −0 shell/db.js
  3. +8 −1 shell/mongo_vstudio.cpp
View
6 jstests/auth2.js
@@ -2,4 +2,8 @@
// SERVER-724
db.runCommand({logout : 1});
-db.runCommand({logout : 1});
+x = db.runCommand({logout : 1});
+assert.eq( 1 , x.ok , "A" )
+
+x = db.logout();
+assert.eq( 1 , x.ok , "B" )
View
5 shell/db.js
@@ -78,6 +78,10 @@ DB.prototype.addUser = function( username , pass, readOnly ){
print( tojson( u ) );
}
+DB.prototype.logout = function(){
+ return this.runCommand({logout : 1});
+}
+
DB.prototype.removeUser = function( username ){
this.getCollection( "system.users" ).remove( { user : username } );
}
@@ -318,6 +322,7 @@ DB.prototype.help = function() {
print("\tdb.isMaster() check replica primary status");
print("\tdb.killOp(opid) kills the current operation in the db");
print("\tdb.listCommands() lists all the db commands");
+ print("\tdb.logout()");
print("\tdb.printCollectionStats()");
print("\tdb.printReplicationInfo()");
print("\tdb.printSlaveReplicationInfo()");
View
9 shell/mongo_vstudio.cpp
@@ -676,7 +676,9 @@ const StringData _jscode_raw_utils =
"\"jstests/killop.js\",\n"
"\"jstests/run_program1.js\",\n"
"\"jstests/notablescan.js\",\n"
-"\"jstests/drop2.js\"] );\n"
+"\"jstests/drop2.js\",\n"
+"\"jstests/dropdb_race.js\",\n"
+"\"jstests/bench_test1.js\"] );\n"
"\n"
"// some tests can't be run in parallel with each other\n"
"var serialTestsArr = [ \"jstests/fsync.js\",\n"
@@ -1745,6 +1747,10 @@ const StringData _jscode_raw_db =
"print( tojson( u ) );\n"
"}\n"
"\n"
+"DB.prototype.logout = function(){\n"
+"return this.runCommand({logout : 1});\n"
+"}\n"
+"\n"
"DB.prototype.removeUser = function( username ){\n"
"this.getCollection( \"system.users\" ).remove( { user : username } );\n"
"}\n"
@@ -1985,6 +1991,7 @@ const StringData _jscode_raw_db =
"print(\"\\tdb.isMaster() check replica primary status\");\n"
"print(\"\\tdb.killOp(opid) kills the current operation in the db\");\n"
"print(\"\\tdb.listCommands() lists all the db commands\");\n"
+"print(\"\\tdb.logout()\");\n"
"print(\"\\tdb.printCollectionStats()\");\n"
"print(\"\\tdb.printReplicationInfo()\");\n"
"print(\"\\tdb.printSlaveReplicationInfo()\");\n"

0 comments on commit 5798ea8

Please sign in to comment.