public function findOne($condition = [], $fields = [], $options = [])
    {
        $options['limit'] = 1;
        $cursor = $this->find($condition, $fields, $options);
        $rows = $cursor->toArray();
        return empty($rows) ? null : current($rows);
    }
public function findOne($condition = [], $fields = [], $options = [])
    {
        $options['limit'] = 1;
        $cursor = $this->find($condition, $fields, $options);
        $rows = $cursor->toArray();
        return empty($rows) ? null : current($rows);
    }
public function findOne ( $ condition = [ ] , $ fields = [ ] , $ options = [ ] ) { $ options [ 'limit' ] = 1 ; $ cursor = $ this -> find ( $ condition , $ fields , $ options ) ; $ rows = $ cursor -> toArray ( ) ; return empty ( $ rows ) ? null : current ( $ rows ) ; }
Returns a single document.
@param array $condition query condition
@param array $fields fields to be selected
@param array $options query options (available since 2.1).
@return array|null the single document. Null is returned if the query results in nothing.
Returns a single document .