Provide access to the result object after executing MapReduce command #147

epicwhale opened this Issue Aug 8, 2011 · 1 comment


None yet

2 participants


When a MapReduce is performed in MongoDb, it returns some very useful and important statistics about the command execution like time taken, input, emit, output (look at the example output below). The ODM has completely hidden access to this result object. It would be a good feature to give access to this result object.

Read more on result object here:

Example Result Object

  'result' => string '' (length=22)
  'timeMillis' => int 194
  'counts' => 
      'input' => int 1431
      'emit' => int 1431
      'output' => int 1064
  'ok' => float 1
jwage commented Jan 4, 2014

You can use ArrayIterator::getCommandResult() for this.

$qb = $this->dm->createQueryBuilder('Documents\Ecommerce\ConfigurableProduct')
    ->mapReduce($map, $reduce);
$query = $qb->getQuery();
$cursor = $query->execute();
$result = $cursor->getCommandResult();

$result will be the raw result of the map reduce command.

@jwage jwage closed this Jan 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment