You are here

function mongodb_drush_command in MongoDB 7

Same name and namespace in other branches
  1. 8 mongodb.drush.inc \mongodb_drush_command()
  2. 6 mongodb.drush.inc \mongodb_drush_command()

Implements hook_drush_command().

File

./mongodb.drush.inc, line 14
Provide drush integration for MongoDB.

Code

function mongodb_drush_command() {

  // $options['--alias'] = 'The alias defined in variable mongodb_collections.';
  $items['mongodb-connect'] = array(
    'description' => 'A string for connecting to the mongodb.',
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION,
    // 'options' => $options,
    'arguments' => array(
      'alias' => 'The connection',
    ),
  );
  $items['mongodb-cli'] = array(
    'description' => "Open a mongodb command-line interface using Drupal's credentials.",
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION,
    // 'options' => $options,
    'examples' => array(
      '`drush mongodb-connect`' => 'Connect to the mongodb.',
    ),
    'arguments' => array(
      'alias' => 'The connection',
    ),
    'aliases' => array(
      'mdbc',
    ),
  );
  $items['mongodb-conf'] = array(
    'description' => 'Print mongodb connection details using print_r().',
    'arguments' => array(
      'all' => 'Show all mongodb connections, instead of just one.',
    ),
    'arguments' => array(
      'alias' => 'The connection',
    ),
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION,
  );
  $items['mongodb-query'] = array(
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_DATABASE,
    'description' => 'Execute a query against the site mongodb.',
    'examples' => array(
      'drush mongodb-query default "db.watchdog.find().forEach(function(x){print(tojson(x))});"' => 'Get the watchdog message templates.',
    ),
    'arguments' => array(
      'alias' => 'The connection',
      'query' => 'A mongodb query. Mandatory.',
    ),
    // 'options' => array(
    // '--extra' => 'Add custom options to the mongodb command.',
    // ) + $options,
    'aliases' => array(
      'mdbq',
    ),
  );
  $items['mongodb-clean-tests'] = [
    'aliases' => [
      'mdct',
    ],
    'description' => 'Clean the Simpletest collections',
  ];
  return $items;
}