Sokil\Mongo\Cursor::findAndUpdate PHP Метод

findAndUpdate() публичный Метод

Find first document and update it
public findAndUpdate ( Operator $operator, boolean $upsert = false, boolean $returnUpdated = true ) : null | Document
$operator Operator operations with document to update
$upsert boolean if document not found - create
$returnUpdated boolean if true - return updated document
Результат null | Document
    public function findAndUpdate(Operator $operator, $upsert = false, $returnUpdated = true)
    {
        $mongoDocument = $this->collection->getMongoCollection()->findAndModify($this->expression->toArray(), $operator ? $operator->toArray() : null, $this->fields, array('new' => $returnUpdated, 'sort' => $this->sort, 'upsert' => $upsert));
        if (!$mongoDocument) {
            return null;
        }
        return $this->collection->hydrate($mongoDocument, $this->isDocumentPoolUsed());
    }