Phalcon\Db\Adapter\MongoDB\Collection::findOneAndUpdate PHP Méthode

findOneAndUpdate() public méthode

The document to return may be null if no document matched the filter. By default, the original document is returned. Specify FindOneAndUpdate::RETURN_DOCUMENT_AFTER for the "returnDocument" option to return the updated document. Note: BSON deserialization of the returned document does not yet support a custom type map (depends on: https://jira.mongodb.org/browse/PHPC-314).
See also: FindOneAndReplace::__construct() for supported options
See also: http://docs.mongodb.org/manual/reference/command/findAndModify/
public findOneAndUpdate ( array | object $filter, array | object $update, array $options = [] ) : object | null
$filter array | object Query by which to filter documents
$update array | object Update to apply to the matched document
$options array Command options
Résultat object | null
    public function findOneAndUpdate($filter, $update, array $options = [])
    {
        $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
        if (!isset($options['writeConcern']) && Functions::serverSupportsFeature($server, self::$wireVersionForFindAndModifyWriteConcern)) {
            $options['writeConcern'] = $this->writeConcern;
        }
        $operation = new FindOneAndUpdate($this->databaseName, $this->collectionName, $filter, $update, $options);
        return $operation->execute($server);
    }