[
https://issues.apache.org/jira/browse/COUCHDB-2065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13902268#comment-13902268
]
Nolan Lawson commented on COUCHDB-2065:
---------------------------------------
Good point. In that case, I suppose the solution would be for Couch to say
"you didn't specify a revision, but I'm going to assume you're working off of
the latest of what I have on this node." Then you'd have the exact same
problem as if two users each GETed C from two separate nodes and then each
PUTed to create D1 and D2. I agree that making E in this case is not really
feasible.
I'd counter, though, that most users are probably working with single-node
architectures (where making E is feasible), and plus if we don't offer this
solution, the majority will never write the {{while (409) reattempt();}} logic
anyway; they'll just have buggy code that's unprepared for 409s.
The model of "whatever I put last, that's the current value," with Couch
picking an arbitrary winner in the multi-mode scenario, is probably more
intuitive to the majority of people, and it also has some valid application use
cases. For those cases, it feels a little silly for clients to have to write
the {{while (409) reattempt();}} logic themselves, especially given the
overhead of all the extra HTTP requests. Is there any technical reason that
Couch couldn't do it on the server side?
> Overwrite a document with a single request
> ------------------------------------------
>
> Key: COUCHDB-2065
> URL: https://issues.apache.org/jira/browse/COUCHDB-2065
> Project: CouchDB
> Issue Type: New Feature
> Security Level: public(Regular issues)
> Reporter: Nolan Lawson
>
> It would be convenient to have the option to overwrite documents with a
> single request, rather than having to GET, check the _rev, POST/PUT, possibly
> deal with conflicts, and then continue POST/PUTing until success. It could
> be something as simple as:
> {code}
> PUT localhost:5984/mydb/mydoc?force=true
> {code}
> If two callers attempt to update the same document at the same time, whoever
> gets there last would win.
> Prompted by a [discussion in
> PouchDB|https://github.com/daleharvey/pouchdb/issues/1388].
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)