On 14/11/2008, at 12:32 PM, Antony Blakey wrote:

{
 "docs": [
/* Just for backwards compatibility ... but does that matter for an alpha product ? */
   ... as now ...
 ],

 "PUT": [
   /* As now with docs, but not allowing "delete":true ? */
   { "_id": ..., "_rev": ..., ... }
   ...
 ],
 "PATCH": [
   { "_id": ..., "_rev": ..., deltas: [ { "replace":... }, ... ] }
   ...
 ],
 "DELETE": [
   { "_id": ..., "_rev": ... },
   ...
 ]
}

This has the benefit of (roughly) representing the HTTP methods that it aggregates.

On second thought, given that it represents an aggregation of commands that have an explicit ordering, maybe it shouldn't be grouped by method but instead use the method as a key. Like this:

[
  { "delete":{ "_id": ..., "_rev": ... } },
  { "put": { "_id": ..., "_rev": ..., ... },
{ "patch": { "_id": ..., "_rev": ... } "with": [ { "replace": ... "with": ... }, ... ] },
  ...
]

The benefit of this that generating this is easier to reason about and generate if your client code is doing deletes and inserts of documents with the same id. It accurately represents adding a transactional boundary without requiring a change in semantics.

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

When I hear somebody sigh, 'Life is hard,' I am always tempted to ask, 'Compared to what?'
  -- Sydney Harris


Reply via email to