mercredi 1 janvier 2020

how can I drop user from "system.users" using mongodb and PHP?

I need a small help.

I can not delete "System.User" user from MongoDB database.

/*Remove Tenent DB*/
function RemoveTenentDB($mydb){
   error_reporting(0);
   $connection_string = Config::get('database.creator-tenant-uri');
   $m = new MongoClient($connection_string); //create interface to mongo
   $command = array
   (
       "dropUser" => $mydb
   );
   $db = $m->selectDB( $mydb );
   $db->command( $command );
   #drop databse
   $db = $m->dropDB( $mydb );
   return true;
}

Below code delete just database and particular database user only not "System.User"

$command = array
   (
       "dropUser" => $mydb
   );
   $db = $m->selectDB( $mydb );
   $db->command( $command );
   $db = $m->dropDB( $mydb );

enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire