You are here

function drush_mongodb_query in MongoDB 7

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

Drush callback; Execute a query against a mongodb.

File

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

Code

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