Example #1
0
 /**
  * @param string $oldName
  * @param string $newName
  * @return array
  * @throws \Exception
  */
 public static function renameDB($oldName, $newName)
 {
     // See http://stackoverflow.com/questions/14701418/rename-mongo-database
     if (!MongoStore::hasDB($oldName)) {
         throw new \Exception("Database " . $oldName . " does not exist; cannot rename it to " . $newName . ".");
     }
     if (MongoStore::hasDB($newName)) {
         throw new \Exception("Database " . $newName . " already exists; not renaming " . $oldName . " to " . $newName . ".");
     }
     $copyResult = MongoStore::copyDB($oldName, $newName);
     $dropResult = MongoStore::dropDB($oldName);
     $result = array('copyResult' => $copyResult, 'dropResult' => $dropResult);
     return $result;
 }
 /**
  * @param string $databaseName
  */
 public static function dropAllCollections($databaseName)
 {
     MongoStore::dropAllCollections($databaseName);
 }