fleetdb icon indicating copy to clipboard operation
fleetdb copied to clipboard

Feature request: put operation

Open renewdoit opened this issue 15 years ago • 3 comments

It will be more natural to have a "put" operation, or "insert-or-update".

renewdoit avatar Jan 18 '10 07:01 renewdoit

This can be implemented at the client level with e.g.

["checked-write",
  ["count", "records", {"where": ["=" "id" _]}],
  0,
  ["insert", "records", {"id": _, "attr1": "val1", ...}]]

Were you aware of this but suggesting that this be implemented in the server for convenience?

Also, just out of curiosity, are you using a particular client library for interacting with FleetDB?

mmcgrana avatar Jan 18 '10 09:01 mmcgrana

Not exactly. What I mean is to check whether a record exists, if not, insert it otherwise update it (merge). I use client side function to deal with it right now, but I think better to provide it at server side to gain better performance. I'm using clojure client library to talk with fleetdb.

renewdoit avatar Jan 19 '10 00:01 renewdoit

Oh right, I see. In order to this completely on the server's side you would need either the "put" operation you mentioned above or a more general compound query that branched on a conditional. I'm not going to add these right away, but I'm putting them on my list to consider in the near future.

Thanks for your input and patience, Mark

mmcgrana avatar Jan 19 '10 17:01 mmcgrana