Open
Description
I have the common scenario that I want to update a field in a document (e.g. when some async calculation completes), if that document still exists. upsert
is almost suitable, except that it would recreate the document instead of ignoring or failing.
So I propose to create either (or both):
- a function
updateIfExists
, that would be likeupsert
but fail silently if the document does not exist. I think fits nicely as a dual toputIfNotExists
. - a function
update
; same idea, but it would fail loudly instead of silently (perhaps better, since it gives the choice whether to ignore the failure).
I'd be happy to provide a PR if you would agree on adding such an extra function (tell me which would be preferred).
Metadata
Assignees
Labels
No labels