You are here

function drush_mongodb_query in MongoDB 6

Same name and namespace in other branches
  1. 7 mongodb.drush.inc \drush_mongodb_query()

Drush callback; Execute a query against a mongodb.

File

./mongodb.drush.inc, line 109
Provide Drush integration for MongoDB.

Code

function drush_mongodb_query($alias = 'default', $query = '') {
  $command = _drush_mongodb_connect($alias);
  $command .= " --eval '{$query}'";
  drush_print(escapeshellcmd($command));
  $standard = array(
    0 => STDIN,
    1 => STDOUT,
    2 => STDERR,
  );
  drush_print(proc_close(proc_open(escapeshellcmd($command), $standard, $pipes)));
}