Wrapper method for MongoClient::dropDB().

This method will dispatch preDropDatabase and postDropDatabase events.

@see http://php.net/manual/en/mongoclient.dropdb.php
@param string $database
@return array
960942
public function dropDatabase($database)
    {
        if ($this->eventManager->hasListeners(Events::preDropDatabase)) {
            $this->eventManager->dispatchEvent(Events::preDropDatabase, new EventArgs($this, $database));
        }

        $this->initialize();
        $result = $this->mongoClient->dropDB($database);

        if ($this->eventManager->hasListeners(Events::postDropDatabase)) {
            $this->eventManager->dispatchEvent(Events::postDropDatabase, new EventArgs($this, $result));
        }

        return $result;
    }
27087
public function database(string $database = null): MongoDatabase
    {
        if (empty($database)) {
            $database = $this->config->defaultDatabase();
        }

        //Spiral support ability to link multiple virtual databases together using aliases
        $database = $this->config->resolveAlias($database);

        if (isset($this->databases[$database])) {
            return $this->databases[$database];
        }

        if (!$this->config->hasDatabase($database)) {
            throw new ODMException(
                "Unable to initiate MongoDatabase, no presets for '{$database}' found"
            );
        }

        $options = $this->config->databaseOptions($database);

        //Initiating database instance
        return $this->createDatabase(
            $database,
            $options['server'],
            $options['database'],
            $options['driverOptions'] ?? [],
            $options['options'] ?? []
        );
    }
1287645
public function listCollections($db = null)
    {
        $collections = [];
        $result = $this->command(['listCollections' => 1], $db);
        foreach ($result as $collection) {
            $collections[] = $collection['name'];
        }

        return $collections;
    }
390545
public function createDatabase($database=null)
    {
        if (!$database) $database = $this->getDatabase();
        $sql = $this->getSchema()->getCreateDatabaseSql($database);
        return $this->query($sql);
    }
201835
public function drop()
    {
        if ($this->eventManager->hasListeners(Events::preDropCollection)) {
            $this->eventManager->dispatchEvent(Events::preDropCollection, new EventArgs($this));
        }

        $result = $this->doDrop();

        if ($this->eventManager->hasListeners(Events::postDropCollection)) {
            $this->eventManager->dispatchEvent(Events::postDropCollection, new EventArgs($this, $result));
        }

        return $result;
    }
553684
function dropDatabase (db, fn) {
  db.connection.db.executeDbCommand({
    dropDatabase: 1
  }, function(err, result) {
    db.disconnect()
    fn && fn(err, result)
  })
}
385814
public function drop()
    {
        if ($this->eventManager->hasListeners(Events::preDropDatabase)) {
            $this->eventManager->dispatchEvent(Events::preDropDatabase, new EventArgs($this));
        }

        $result = $this->mongoDB->drop();

        if ($this->eventManager->hasListeners(Events::postDropDatabase)) {
            $this->eventManager->dispatchEvent(Events::postDropDatabase, new EventArgs($this));
        }

        return $result;
    }
396290
public function exec(Db $db) {
        $options = [
            'limit' => $this->limit,
            'offset' => $this->offset
        ];

        $r = $db->get($this->from, $this->where, $options);
        return $r;
    }
1025834
public function db($database = null)
    {
        if (empty($database)) {
            $database = $this->database;
        }
        return $this->silex['dbs'][$database];
    }
461634
private function databaseCanBeOverwritten($database)
    {
        $canBeOverwritten = true;

        if (!$this->userDecidedOverwriteDB()) {
            $canBeOverwritten = !$this->getUtilitiesInstance()->checkDbExists($database);
        }

        return $canBeOverwritten;
    }
134085
public function useDb($database)
    {
        switch ($this->driver) {
            case 'mysql':
                $this->query("USE `$database`");
                $this->dbname = $database;
                break;

            default:
                throw new \RuntimeException(sprintf('Unsupported switching database for current driver: %s', $this->driver));
        }
        return $this;
    }
757766
public function drop()
    {
        $conn = $this->connection->getConnection();
        $db = r\db($this->connection->getDatabaseName());
        $db->tableDrop($this->table)->run($conn);
    }
1354651
protected function getGenericDatabases(array $databases)
    {
        $genericDatabases = array();

        foreach ($databases as $database) {
            $genericDatabases[] = $this->getGenericDatabase($database);
        }

        return $genericDatabases;
    }
970764
public function listCollections($db = '')
    {
        $cursor = $this->cmd('listCollections', null, $db);
        $result = [];
        foreach ($cursor as $collection) {
            $result[] = $collection['name'];
        }
        return $result;
    }
911876
public static function dropCollection($db = '', $col = '')
		{
			if (empty($db)) {
				throw new Exception('Failed to drop MongoDB collection because database name is empty');
			}

			if (empty($col)) {
				throw new Exception('Failed to drop MongoDB collection because collection name is empty');
			} else {
				try {
					static::instance()->connection->{$db}->{$col}->drop();

					return true;
				} catch (\Exception $e) {
					throw new Exception("Unable to drop Mongo collection `{$col}`: {$e->getMessage()}", $e->getCode());
				}
			}
		}
640286
public function removeDatabase(Database $database)
    {
        if($this->getDatabases()->contains($database)) {
            $this->getDatabases()->remove($database);
        }
    }
1310915
public static function getDatabaseConfig($database)
    {
        $cached = self::$cache[$database] ?? null;
        if ($cached !== null) {
            return $cached;
        }

        if (self::$config === null) {
            throw new \BadMethodCallException('Config was not loaded');
        }
        if (!array_key_exists($database, self::$config['databases'])) {
            throw new \LogicException("Unknown database '$database'");
        }

        $data = self::$config['databases'][$database];
        if (is_string($data)) {
            $data = ['database_name' => $data];
        }

        $server = $data['server'] ?? 'default';
        $servers = self::$config['servers'] ?? [];
        if (array_key_exists($server, $servers)) {
            unset($data['server']);
            $data = array_merge($servers[$server], $data);
        }

        self::$cache[$database] = $data;
        return $data;
    }