public function update($model_or_id, $update_vars, $mongo_options=[]) {
        $id = $this->extractID($model_or_id);

        $update_vars = $this->onUpdate_pre($update_vars, $model_or_id);

        $sql = $this->buildUpdateStatement($update_vars, ['id']);

        $sth = $this->connection_manager->executeWithReconnect(function($mysql_dbh) use ($sql, $update_vars, $id) {
            $sth = $mysql_dbh->prepare($sql);
            $vars = $this->removeMysqlLiterals(array_values($update_vars));
            $vars[] = $id;
            $result = $sth->execute($vars);
            return $sth;
        });

        return $sth->rowCount();
    }