diff --git a/lib/Doctrine/MongoDB/Collection.php b/lib/Doctrine/MongoDB/Collection.php index 5d33c5a4..5e8e34b1 100644 --- a/lib/Doctrine/MongoDB/Collection.php +++ b/lib/Doctrine/MongoDB/Collection.php @@ -716,6 +716,12 @@ protected function doMapReduce($map, $reduce, array $out, array $query, array $o return new ArrayIterator($result['results']); } + if (isset($result['result']['db'], $result['result']['collection'])) { + return $this->connection + ->selectCollection($result['result']['db'], $result['result']['collection']) + ->find(); + } + return $this->database->selectCollection($result['result'])->find(); }