couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Young (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1303) Add a _bulk_update handler similar to _update but for bulk document changes
Date Mon, 09 Dec 2013 13:08:07 GMT


Benjamin Young commented on COUCHDB-1303:

It would seem that allowing `_update` to store multiple documents would be the easier approach.

This is the current code for saving documents and responding to an `_update` request:

Perhaps making the first element of the return array support multiple JSON objects (i.e. return
[[doc1, doc2], {..headers..}]; ) would be a good first step.

The next step would be to allow `_update` (with no doc_id specified in the URL support the
bulk_docs JSON format for POSTs).

Likely this could be broken into two separate commits (and Jira tickets) as they have separate
1. sending in a single `_update` request and having multiple documents changed
2. sending in a bulk_docs formatted `_update` POST and having those documents handled and/or
other documents generated/updated.

I don't think (now) that a `_bulk_update` endpoint would be needed.

Additionally, the use of redirect responses from an `_update` handler might work now has a
work around, it's not something I'd care to depend on (nor see shipped in CouchDB) due to
there being no guarantee that the Location header would actually be followed by the client,
and therefore no guarantee that the second (or more) updates would actually be done. It could
certainly work if you control the whole stack and are OK with the potential of the redirects
failing at times.

Thanks for drawing attention to this issue in any case!

> Add a _bulk_update handler similar to _update but for bulk document changes
> ---------------------------------------------------------------------------
>                 Key: COUCHDB-1303
>                 URL:
>             Project: CouchDB
>          Issue Type: New Feature
>            Reporter: Benjamin Young
>              Labels: api, update_request_handler
> _update handlers are great (and getting better!) for building RESTful API's inside CouchDB.
One limitation I found tonight is that _update can only do a single document at a time. If
the API I'm building needs to update multiple docs (in a similar fashion to _bulk_docs), then
an outside "proxy" script is required. It would be ideal to have a _bulk_update handler to
allow for the same functionality as _update, but with the ability to insert multiple documents
at once.
> Perhaps the current _update handler API could be extended to support multiple IDs/documents,
but a separate API endpoint would be seem reasonable if needed.
> Thanks for considering this idea.

This message was sent by Atlassian JIRA

View raw message