diff --git a/lib/phpcouch/record/ViewResultRow.php b/lib/phpcouch/record/ViewResultRow.php index 91f8bfd..d37fdb4 100644 --- a/lib/phpcouch/record/ViewResultRow.php +++ b/lib/phpcouch/record/ViewResultRow.php @@ -44,7 +44,7 @@ public function getDocument($accessor = null, $retrieve = false) // the value contains the document itself $doc = $this->value; // if the view didn't emit the actual doc as value but was called with include_docs=true - if(!$doc || (!isset($doc->_id) && !isset($doc['_id']))) { + if((isset($this->doc) && $this->doc instanceof \StdClass) || !$doc || (!isset($doc->_id) && !isset($doc['_id']))) { $doc = $this->doc; } } elseif(is_callable($accessor)) {