lib/Doctrine/MongoDB/Cursor.php
public function getSingleResult()
    {
        $originalLimit = $this->limit;
        $originalUseIdentifierKeys = $this->useIdentifierKeys;

        $this->reset();
        $this->limit(1);
        $this->setUseIdentifierKeys(false);

        $result = current($this->toArray()) ?: null;

        $this->reset();
        $this->limit($originalLimit);
        $this->setUseIdentifierKeys($originalUseIdentifierKeys);

        return $result;
    }
public function getSingleResult()
    {
        $originalLimit = $this->limit;
        $originalUseIdentifierKeys = $this->useIdentifierKeys;

        $this->reset();
        $this->limit(1);
        $this->setUseIdentifierKeys(false);

        $result = current($this->toArray()) ?: null;

        $this->reset();
        $this->limit($originalLimit);
        $this->setUseIdentifierKeys($originalUseIdentifierKeys);

        return $result;
    }
public function getSingleResult ( ) { $ originalLimit = $ this -> limit ; $ originalUseIdentifierKeys = $ this -> useIdentifierKeys ; $ this -> reset ( ) ; $ this -> limit ( 1 ) ; $ this -> setUseIdentifierKeys ( false ) ; $ result = current ( $ this -> toArray ( ) ) ? : null ; $ this -> reset ( ) ; $ this -> limit ( $ originalLimit ) ; $ this -> setUseIdentifierKeys ( $ originalUseIdentifierKeys ) ; return $ result ; }
Reset the cursor and return its first result.

The cursor will be reset both before and after the single result is
fetched. The original cursor limit (if any) will remain in place.

@see Iterator::getSingleResult()
@return array|object|null
Reset the cursor and return its first result .