Update a document and return it
public findAndModify ( array $query, array $update = null, array $fields = null, array $options = [] ) : array | ||
$query | array | The query criteria to search for. |
$update | array | The update criteria. |
$fields | array | Optionally only return these fields. |
$options | array | An array of options to apply, such as remove the match document from the DB and return it. |
return | array | Returns the original document, or the modified document when new is set. |