Mongolid\Cursor\Cursor::first PHP Method

first() public method

Returns the first element of the cursor.
public first ( ) : mixed
return mixed
    public function first()
    {
        $this->rewind();
        $document = $this->getCursor()->current();
        if (!$document) {
            return;
        }
        $document = $this->getConverter()->toDomainTypes((array) $document);
        return $this->getAssembler()->assemble($document, $this->entitySchema);
    }