4 ms·
put implies overwriting instead of updating. upsert is for you insert/update.
by eggn00dles 1y ago
put implies overwriting instead of updating.
upsert is for you insert/update.
- pas 1y agoupdate already means overwriting. semantically PUT is exactly upsert. upsert is update + create if not exists, which is exactly PUT any update without overwrite is "append" or "extend" (or something else)
- eggn00dles 1y agoappend or extend is adding keys without updating existing keys. update can add keys and update existing keys. put will blow away existing keys if they dont exist in the new payload. which is why it cant be upsert.
- pas 1y ago... it depends on how the given server defines PUT of course (also how we define upsert, and does upsert make sense outside a DB setting? well, of course some DBs have a HTTP/ReST API.) that said, usually PUT is meaningful for a URL (or URI), and in these circumstances it's like upsert, and it cannot blow away other keys, as it operates on one key, given by the URL of course if we assume a batch endpoint, sure, it then can do non-upsert-like things