upsert icon indicating copy to clipboard operation
upsert copied to clipboard

Upsert without update function

Open indo-dev-0 opened this issue 5 years ago • 0 comments

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);

indo-dev-0 avatar Jul 26 '19 07:07 indo-dev-0