You are here

public function Drush::creds in MongoDB 8

File

drivers/lib/Drupal/Driver/Database/mongodb/Drush.php, line 19

Class

Drush

Namespace

Drupal\Driver\Database\mongodb

Code

public function creds($hide_password = TRUE) {
  $parameters = [];
  if ($this->db_spec['username']) {
    $parameters['u'] = $this->db_spec['username'];
  }
  if ($this->db_spec['password']) {
    $parameters['p'] = $this->db_spec['password'];
  }
  $return = $parameters ? $this
    ->params_to_options($parameters) : '';

  // The mongo shell doesn't want the mongodb:// in the beginning.
  return $return . ' ' . substr($this->db_spec['database'], 10);
}