Phalcon\Db\Adapter\MongoDB\UpdateResult::getUpsertedId PHP Method

getUpsertedId() public method

This value is undefined (i.e. null) if an upsert did not take place. This method should only be called if the write was acknowledged.
See also: UpdateResult::isAcknowledged()
public getUpsertedId ( ) : mixed | null
return mixed | null
    public function getUpsertedId()
    {
        if ($this->isAcknowledged) {
            foreach ($this->writeResult->getUpsertedIds() as $id) {
                return $id;
            }
            return null;
        }
        throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__);
    }