From 2891b5e5b357fa334e0b35203d55da1a58995eca Mon Sep 17 00:00:00 2001 From: Pulkit Singhal Date: Mon, 30 Mar 2015 09:52:08 -0500 Subject: [PATCH] check if id does not exist a bit more explicitly if left as-is, ids with value of zero were treated as non-existent --- lib/dao.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dao.js b/lib/dao.js index fe406878..dad80cc1 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -361,7 +361,7 @@ DataAccessObject.updateOrCreate = DataAccessObject.upsert = function upsert(data var hookState = {}; var id = getIdValue(this, data); - if (!id) { + if (id === undefined || id === null) { return this.create(data, options, cb); }