public function find($collectionName, $condition, $options = [])
    {
        $queryBuilder = $this->db->getQueryBuilder();

        $this->document = $queryBuilder->buildCondition($condition);

        if (isset($options['projection'])) {
            $options['projection'] = $queryBuilder->buildSelectFields($options['projection']);
        }

        if (isset($options['sort'])) {
            $options['sort'] = $queryBuilder->buildSortFields($options['sort']);
        }

        if (array_key_exists('limit', $options)) {
            if ($options['limit'] === null || !ctype_digit((string) $options['limit'])) {
                unset($options['limit']);
            } else {
                $options['limit'] = (int)$options['limit'];
            }
        }
        if (array_key_exists('skip', $options)) {
            if ($options['skip'] === null || !ctype_digit((string) $options['skip'])) {
                unset($options['skip']);
            } else {
                $options['skip'] = (int)$options['skip'];
            }
        }

        return $this->query($collectionName, $options);
    }
public function find($collectionName, $condition, $options = [])
    {
        $queryBuilder = $this->db->getQueryBuilder();

        $this->document = $queryBuilder->buildCondition($condition);

        if (isset($options['projection'])) {
            $options['projection'] = $queryBuilder->buildSelectFields($options['projection']);
        }

        if (isset($options['sort'])) {
            $options['sort'] = $queryBuilder->buildSortFields($options['sort']);
        }

        if (array_key_exists('limit', $options)) {
            if ($options['limit'] === null || !ctype_digit((string) $options['limit'])) {
                unset($options['limit']);
            } else {
                $options['limit'] = (int)$options['limit'];
            }
        }
        if (array_key_exists('skip', $options)) {
            if ($options['skip'] === null || !ctype_digit((string) $options['skip'])) {
                unset($options['skip']);
            } else {
                $options['skip'] = (int)$options['skip'];
            }
        }

        return $this->query($collectionName, $options);
    }
public function find ( $ collectionName , $ condition , $ options = [ ] ) { $ queryBuilder = $ this -> db -> getQueryBuilder ( ) ; $ this -> document = $ queryBuilder -> buildCondition ( $ condition ) ; if ( isset ( $ options [ 'projection' ] ) ) { $ options [ 'projection' ] = $ queryBuilder -> buildSelectFields ( $ options [ 'projection' ] ) ; } if ( isset ( $ options [ 'sort' ] ) ) { $ options [ 'sort' ] = $ queryBuilder -> buildSortFields ( $ options [ 'sort' ] ) ; } if ( array_key_exists ( 'limit' , $ options ) ) { if ( $ options [ 'limit' ] === null || ! ctype_digit ( ( string ) $ options [ 'limit' ] ) ) { unset ( $ options [ 'limit' ] ) ; } else { $ options [ 'limit' ] = ( int ) $ options [ 'limit' ] ; } } if ( array_key_exists ( 'skip' , $ options ) ) { if ( $ options [ 'skip' ] === null || ! ctype_digit ( ( string ) $ options [ 'skip' ] ) ) { unset ( $ options [ 'skip' ] ) ; } else { $ options [ 'skip' ] = ( int ) $ options [ 'skip' ] ; } } return $ this -> query ( $ collectionName , $ options ) ; }
Performs find query.
@param string $collectionName collection name
@param array $condition filter condition
@param array $options query options.
@return \MongoDB\Driver\Cursor result cursor.
Performs find query .