couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Hinrichs - DM&T" <dunde...@gmail.com>
Subject Re: _bulk_docs inconsistency
Date Tue, 07 Apr 2009 02:44:58 GMT
On Mon, Apr 6, 2009 at 9:35 PM, Jeff Hinrichs - DM&T <dundeemt@gmail.com>wrote:

> While it might be a bug, it does work as expected.  According to the docs,
> http://wiki.apache.org/couchdb/HTTP_Document_API .
>
> Using 0.9, (r 760733) uploading a doc with attachments and a _rev does not
> cause any error.
>
Grrr. I take that back.  My test case wasn't testing what I thought it was.
I do get the error.  I believe that it is the second that is the bug, not
the first.

Regards,

Jeff Hinrichs

>
> Regards,
>
> Jeff Hinrichs
>
>
>
> On Mon, Apr 6, 2009 at 12:55 PM, Damien Katz <damien@apache.org> wrote:
>
>> Looks like a bug, you should get a conflict error on the first update.
>> Please create a bug report with a failing JS test case.
>>
>> -Damien
>>
>>
>>
>> On Apr 6, 2009, at 1:42 PM, Matt Goodall wrote:
>>
>>  Hi,
>>>
>>> I came across an inconsistency with _bulk_docs when creating new
>>> documents, i.e. calling _bulk_docs against an empty database.
>>>
>>> It seems that it's ok to create a new document from a JSON object that
>>> includes a _rev ... unless the JSON also has inline attachments:
>>>
>>> $ curl -X "POST" -d
>>> "{\"docs\":[{\"_id\":\"a\",\"_rev\":\"1-3864900503\"}]}"
>>> "http://localhost:5984/test/_bulk_docs"
>>> [{"id":"a","rev":"2-1966182305"}]
>>> $ curl -X "POST" -d
>>>
>>> "{\"docs\":[{\"_id\":\"b\",\"_rev\":\"2-3530543911\",\"_attachments\":{\"hello.txt\":{\"content_type\":\"text/plain\",\"data\":\"SGVsbG8K\"}}}]}"
>>> "http://localhost:5984/test/_bulk_docs"
>>> [{"id":"b","error":"conflict","reason":"Document update conflict."}]
>>>
>>> I'll write JS tests for this and create a ticket but, at this stage,
>>> I'm not sure what the correct behaviour is:
>>>
>>> 1. CouchDB should not allow a document to be created from JSON
>>> containing a _rev at all.
>>> 2. JSON that includes _rev and _attachements should work.
>>>
>>> Assuming the _rev is allowed, should CouchDB then:
>>>
>>> 1. Completely ignore the _rev in the JSON and assign a new 1-based
>>> rev, i.e. 1-abc in, 1-def out.
>>> 2. Allow the _rev in the JSON and assign a new, incremented rev, i.e.
>>> 1-abc in, 2-def out.
>>> 3. Accept the _rev in the JSON as-is, i.e. 1-abc in, 1-abc out. (I'm
>>> not expecting this one to be correct!)
>>>
>>> - Matt
>>>
>>
>>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message