couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geoffrey Cox (JIRA)" <j...@apache.org>
Subject [jira] [Created] (COUCHDB-2278) Partial updates via _bulk_docs
Date Fri, 25 Jul 2014 00:11:39 GMT
Geoffrey Cox created COUCHDB-2278:
-------------------------------------

             Summary: Partial updates via _bulk_docs
                 Key: COUCHDB-2278
                 URL: https://issues.apache.org/jira/browse/COUCHDB-2278
             Project: CouchDB
          Issue Type: Wish
      Security Level: public (Regular issues)
            Reporter: Geoffrey Cox


I'm trying to create a collaborative app that allows two users to edit different attributes
in the same document simultaneously. For example, client 1 can edit the task name, while client
2 can edit the priority. If I attempt to then sync the clients with the database via _bulk_docs,
the "later" client overwrites the "earlier" client.

An alternative to using _bulk_docs is to use update handlers (http://wiki.apache.org/couchdb/Document_Update_Handlers),
but this requires an API call for each update, which is a lot less efficient than using _bulk_docs.

Another alternative is to first get the full document from couch before issuing a call to
_bulk_docs, but this again requires an additional call to "get" the document.

Let's say our documents look like:
{code}
[{id: 1111, name: 'take out trash', priority: 'high'},
{id: 2222, name: 'clean dishes', priority: 'medium'}]
{code}

It would be great if our two example _bulk_docs calls from client 1&2 could be like:

client1:
{code}
_bulk_docs: [{id: 1111, name: 'take out trash and recycling'},
{id: 2222, priority: 'high'}]
{code}

client2:
{code}
_bulk_docs: [{id: 1111, priority: 'medium'},
{id: 2222, name: 'clean & dry dishes'}]
{code}

which would result in the following in couch:
{code}
[{id: 1111, name: 'take out trash and recycling', priority: 'medium'},
{id: 2222, name: 'clean & dry dishes', priority: 'high'}]
{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message