You are here

function mongodb_drush_command in MongoDB 6

Same name and namespace in other branches
  1. 8 mongodb.drush.inc \mongodb_drush_command()
  2. 7 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() {
  $items['mongodb-connect'] = array(
    'description' => 'A string for connecting to the mongodb.',
    'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION,
    '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,
    '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 "db.watchdog.find().forEach(function(x){print(tojson(x))});"' => 'Get the watchdog entries.',
    ),
    'arguments' => array(
      'alias' => 'The connection',
      'query' => 'A mongodb query. Mandatory.',
    ),
    'aliases' => array(
      'mdbq',
    ),
  );
  return $items;
}