upsert
upsert copied to clipboard
Upsert without update function
It would be nice if I could just pass in a document and not worry about the update function: db.upsert(docId, diffFunc|doc [, callback])
. I usually just want to overwrite the old document and this would be a nice ergonomic enhancement:
let doc = {id: "12345", foo: "baz"};
db.upsert(doc.id, (old) => {
return doc;
});
//vs
db.upsert(doc.id, doc);