@param array $filter
@param array $options

@return array|Unserializable|null
431331
public function findOneAndDelete(array $filter, array $options = [])
    {
        $options = ['remove' => true] + FindOneAndDeleteResolver::resolveStatic($options);

        return $this->findAndModify($filter, $options);
    }
341097
protected function parseFilter($filter, array $options)
	{
		$parameters = array();

		$original = $filter;

		if ($filter instanceof Closure)
		{
			$filter = $this->registerClosureFilter($filter);
		}
		elseif ($this->isInstanceFilter($filter))
		{
			$filter = $this->registerInstanceFilter($filter);
		}
		else
		{
			list($filter, $parameters) = Route::parseFilter($filter);
		}

		return compact('original', 'filter', 'parameters', 'options');
	}
741805
public function deleteDocument($filters, array $options = [])
    {
        $data = [];

        if (is_string($filters)) {
            $data['_id'] = $filters;
            $action = 'delete';
        } else {
            $data['body'] = ['query' => (object)$filters];
            $action = 'deleteByQuery';
        }

        $response = $this->kuzzle->query(
            $this->buildQueryArgs('document', $action),
            $this->kuzzle->addHeaders($data, $this->headers),
            $options
        );

        return $action === 'delete' ? $response['result']['_id'] : $response['result']['ids'];
    }
864221
public function updateMany(array $filter, $update, array $options = [])
    {
        list($bulkOptions, $options) = self::extractBulkWriteOptions($options);
        $model = new UpdateMany($filter, $update, $options);

        $bulkWriteResult = $this->bulkWrite([$model], $bulkOptions);

        return new UpdateResult($bulkWriteResult);
    }
166646
public function delete($filter, array $options = [])
    {
        $this->ensureAllowedMethodCall(__METHOD__);

        if (isset($options['collation']) && !$this->server->supportsCollation()) {
            throw new UnsupportedException(
                'Option "collation" is not supported by the server.'
            );
        }

        if (null !== $this->listener) {
            $this->listener->beforeDelete($filter, $options);
        }

        $this->getWrappedBulk()->delete($filter, $options);
        $this->currentPosition += 1;
    }
458864
public function replaceOne(array $filter, $replacement, array $options = [])
    {
        $this->writeModels[] = [BulkWrite::REPLACE_ONE => [$filter, $replacement, $options]];

        return $this;
    }
567914
static function GetData($name, $filter = FILTER_DEFAULT, $options = null)
    {
        return filter_input(INPUT_GET, $name, $filter, $options);
    }
467843
protected function _hasRefsIn($key, $filter, $options, $ttl = 0) {
		$type = $this->fieldConf[$key]['relType'];
		$fieldConf = $this->fieldConf[$key][$type];
		// one-to-many shortcut
		$rel = $this->getRelFromConf($fieldConf,$key);
		$hasSet = $rel->find($filter, $options, $ttl);
		if (!$hasSet)
			return false;
		$hasSetByRelId = array_unique($hasSet->getAll($fieldConf[1], true));
		return empty($hasSetByRelId) ? false : $hasSetByRelId;
	}
1100325
public function find(array $filter = [], array $options = [])
    {
        $options += ['typeMap' => $this->typeMap];
        $options = QueryOptionsResolver::resolveStatic($options);
        $typeMap = $options['typeMap'];
        unset($options['typeMap']);

        if (isset($options['readPreference'])) {
            $readPreference = $options['readPreference'];
            unset($options['readPreference']);
        } else {
            $readPreference = $this->readPreference;
        }

        $query = new Query($filter, $options);
        $query->setDefaultReadConcern($this->readConcern);

        $cursor = $this->manager->executeQuery(
            $this->getNamespace(),
            $query,
            $readPreference
        );

        $cursor->setTypeMap($typeMap);

        return $cursor;
    }
982420
public function search(array $filters, array $options = [])
    {
        $data = [
            'body' => $filters
        ];

        $response = $this->kuzzle->query(
            $this->buildQueryArgs('document', 'search'),
            $this->kuzzle->addHeaders($data, $this->headers),
            $options
        );

        $response['result']['hits'] = array_map(function ($document) {
            return new Document($this, $document['_id'], $document['_source'], $document['_meta']);
        }, $response['result']['hits']);


        if (array_key_exists('_scroll_id', $response['result'])) {
            $options['scrollId'] = $response['result']['_scroll_id'];
        }

        return new SearchResult(
            $this,
            $response['result']['total'],
            $response['result']['hits'],
            array_key_exists('aggregations', $response['result']) ? $response['result']['aggregations'] : [],
            $options,
            $filters,
            array_key_exists('previous', $options) ? $options['previous'] : null
        );
    }
435247
public function prependAfterFilter($filter, array $options = [])
    {
        array_unshift($this->afterFilters, $this->parseFilter($filter, $options));
    }
869936
function find($filter=NULL,array $options=NULL,$ttl=0) {
		if (!$options)
			$options=[];
		$options+=[
			'group'=>NULL,
			'order'=>NULL,
			'limit'=>0,
			'offset'=>0
		];
		return $this->select($this->fields,$filter,$options,$ttl);
	}
603773
public function applyFilter($filter, array $options = [])
    {
        if (! ($this->resource instanceof ImageFilterableInterface)) {
            throw new UnsupportedMethodException("This method is not supported by the ImageResource in use.");
        }

        $filter = $this->getFilterResolver()->resolve($filter);

        if (!$filter) {
            throw new FilterNotFoundException();
        }

        $filter->apply($this, $options);

        return $this;
    }
499090
public function addFilter($filterName, $options = [])
    {
        // Create the filter hash so we can run multiple versions of the same filter
        $filterHash = sprintf('%s_%s', strtolower($filterName), md5(json_encode($options)));

        // Add the filter
        $this->options['filters'][$filterHash] = [
            'filter'  => strtolower($filterName),
            'options' => $options,
        ];

        unset($filterHash);

        return $this;
    }
1293340
public function deleteMany(array $filter, array $options = [])
    {
        $this->writeModels[] = [BulkWrite::DELETE_MANY => [$filter, $options]];

        return $this;
    }
1184572
public function findOneAndUpdate(array $filter, array $update, array $options = [])
    {
        $options['typeMap'] = [
            'root' => $this->documentManager->getProxyClass($this->documentClass),
            'document' => 'array',
        ];

        $document = $this->getCollection()->findOneAndUpdate($filter, $update, $options);
        if ($document instanceof DocumentManagerAwareInterface) {
            $document->setManager($this->documentManager);
        }

        return $document;
    }
166744
public function find($filter = null)
    {
        if (is_string($filter)) {
            json_decode($filter);
            $isJson = (json_last_error() === JSON_ERROR_NONE) ? true :false;
            if ($isJson) {
                $filter = new Filter($filter);
                return $this->_getObjectsByFilter($filter);
            } else {
                return $this->_getObject($filter);
            }
        } else if (is_object($filter) && $filter instanceof Filter) {
            return $this->_getObjectsByFilter($filter);
        }
        return [];
    }