From 114a0ae068e39bbef5f973242db8d707952ddd84 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 2 Aug 2013 14:54:51 -0400 Subject: [PATCH] Fix cursor creation when MR's db output option is used --- lib/Doctrine/MongoDB/Collection.php | 6 ++++++ 1 file changed, 6 insertions(+) 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(); }