couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geoffrey Cox (JIRA)" <>
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
             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 (,
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:
[{id: 1111, name: 'take out trash', priority: 'high'},
{id: 2222, name: 'clean dishes', priority: 'medium'}]

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

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

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

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

This message was sent by Atlassian JIRA

View raw message