overload upsert (id, data)

This commit is contained in:
AJ ONeal 2015-11-17 08:29:45 +00:00
parent fdb142ecbf
commit e480e29943
1 changed files with 5 additions and 1 deletions

View File

@ -149,6 +149,11 @@ function wrap(db, dir) {
}; };
DB.upsert = function (id, data) { DB.upsert = function (id, data) {
if (!data) {
data = id;
id = data[idnameCased];
}
return DB.set(id, data).then(function (result) { return DB.set(id, data).then(function (result) {
var success = result.changes >= 1; var success = result.changes >= 1;
@ -179,7 +184,6 @@ function wrap(db, dir) {
} else { } else {
//console.log('[debug result of set]', result.sql); //console.log('[debug result of set]', result.sql);
delete result.sql; delete result.sql;
console.log(result);
} }
return null; return null;