diff --git a/lib/mysql.js b/lib/mysql.js index 5f3cafc..b04e190 100644 --- a/lib/mysql.js +++ b/lib/mysql.js @@ -215,9 +215,13 @@ MySQL.prototype.updateOrCreate = function (model, data, callback) { } else { v = data[key]; } - fieldsNames.push(k); - fieldValues.push(v); - if (!mysql.id(model, key)) combined.push(k + ' = ' + v); + if (v !== undefined) { + fieldsNames.push(k); + fieldValues.push(v); + if (!mysql.id(model, key)) { + combined.push(k + ' = ' + v); + } + } } });