You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Michael S <mi...@hotmail.de> on 2013/09/30 10:05:38 UTC

Problem with changes feed and style=all_docs

Hi together,

I am using CouchDB Version 1.4.0 and the Changes Feed, but I have a 
litte problem with the style option 
(http://localhost:5984/db1/_changes?style=all_docs) in the query 
request. The JSON output does not return all leaf revisions in the 
changes array (including conflicts and deleted former conflictes) - 
which is mentioned in the official CouchDB documentation.

Please see my example and the JSON output
curl -X GET http://localhost:5984/db1/_changes?style=all_docs
{"results":[
{"seq":3,"id":"81abd28f263b2046ddfc867247007275","changes":[{"rev":"3-1a796ab41eeb8bafd3d6025a4b31928f"}]} 

],
"last_seq":3}

The JSON output is also the same as with style=main_only and I can also 
query all revisions of the document _id 
81abd28f263b2046ddfc867247007275.....

Is this a known bug?

Michael

Re: Problem with changes feed and style=all_docs

Posted by Michael S <mi...@hotmail.de>.
Hi Alexander,

thank you very much for the curl example. Sorry maybe it was a mistake, 
because I thought I would get all revisions of the document also 
including the deleted+conflicts when I am querying the changes feed with 
?style=all_docs.

But I looked into the erlang code - "couch_changes.erl" and tried it in 
the erlang shell and seems to be correct :-)
-> couch_db:open_doc(Db2, DocInfo2, [deleted, conflicts])

Thanks,
Michael

Am 30.09.13 10:39, schrieb Alexander Shorin:
> Hi Michael,
>
> Are you sure that there are any conflicted leafs for the
> 81abd28f263b2046ddfc867247007275 document?
>
> [~]$ curl -X PUT http://localhost:5984/conflicts
> {"ok":true}
>
> [~]$ curl -X PUT http://localhost:5984/conflicts/doc \
>          -d '{"foo":"bar"}' \
>          -H "Content-Type: application/json"
> {"ok":true,"id":"doc","rev":"1-4c6114c65e295552ab1019e2b046b10e"}
>
> [~]$ curl -X PUT http://localhost:5984/conflicts/doc\?new_edits\=false \
>          -d '{"bar":"baz", "_rev": "1-078e832b49edb2a4b05b6d9ba627ff2f"}' \
>          -H "Content-Type: application/json"
> {"ok":true,"id":"doc","rev":"1-078e832b49edb2a4b05b6d9ba627ff2f"}
>
> [~]$ curl http://localhost:5984/conflicts/_changes\?style\=main_only
> {"results":[
> {"seq":2,"id":"doc","changes":[{"rev":"1-4c6114c65e295552ab1019e2b046b10e"}]}
> ],
> "last_seq":2}
>
> [~]$ curl http://localhost:5984/conflicts/_changes\?style\=all_docs
> {"results":[
> {"seq":2,"id":"doc","changes":[{"rev":"1-4c6114c65e295552ab1019e2b046b10e"},{"rev":"1-078e832b49edb2a4b05b6d9ba627ff2f"}]}
> ],
> "last_seq":2}
>
> You may query document with meta=true query parameter to verify that
> conflicts are exists for this document:
>
> [~]$ curl http://localhost:5984/conflicts/doc\?meta\=true
> {"_id":"doc","_rev":"1-4c6114c65e295552ab1019e2b046b10e","foo":"bar","_revs_info":[{"rev":"1-4c6114c65e295552ab1019e2b046b10e","status":"available"}],"_conflicts":["1-078e832b49edb2a4b05b6d9ba627ff2f"]}
>
> --
> ,,,^..^,,,
>
>
> On Mon, Sep 30, 2013 at 12:05 PM, Michael S <mi...@hotmail.de> wrote:
>> Hi together,
>>
>> I am using CouchDB Version 1.4.0 and the Changes Feed, but I have a litte
>> problem with the style option
>> (http://localhost:5984/db1/_changes?style=all_docs) in the query request.
>> The JSON output does not return all leaf revisions in the changes array
>> (including conflicts and deleted former conflictes) - which is mentioned in
>> the official CouchDB documentation.
>>
>> Please see my example and the JSON output
>> curl -X GET http://localhost:5984/db1/_changes?style=all_docs
>> {"results":[
>> {"seq":3,"id":"81abd28f263b2046ddfc867247007275","changes":[{"rev":"3-1a796ab41eeb8bafd3d6025a4b31928f"}]}
>> ],
>> "last_seq":3}
>>
>> The JSON output is also the same as with style=main_only and I can also
>> query all revisions of the document _id
>> 81abd28f263b2046ddfc867247007275.....
>>
>> Is this a known bug?
>>
>> Michael
>


Re: Problem with changes feed and style=all_docs

Posted by Alexander Shorin <kx...@gmail.com>.
Hi Michael,

Are you sure that there are any conflicted leafs for the
81abd28f263b2046ddfc867247007275 document?

[~]$ curl -X PUT http://localhost:5984/conflicts
{"ok":true}

[~]$ curl -X PUT http://localhost:5984/conflicts/doc \
        -d '{"foo":"bar"}' \
        -H "Content-Type: application/json"
{"ok":true,"id":"doc","rev":"1-4c6114c65e295552ab1019e2b046b10e"}

[~]$ curl -X PUT http://localhost:5984/conflicts/doc\?new_edits\=false \
        -d '{"bar":"baz", "_rev": "1-078e832b49edb2a4b05b6d9ba627ff2f"}' \
        -H "Content-Type: application/json"
{"ok":true,"id":"doc","rev":"1-078e832b49edb2a4b05b6d9ba627ff2f"}

[~]$ curl http://localhost:5984/conflicts/_changes\?style\=main_only
{"results":[
{"seq":2,"id":"doc","changes":[{"rev":"1-4c6114c65e295552ab1019e2b046b10e"}]}
],
"last_seq":2}

[~]$ curl http://localhost:5984/conflicts/_changes\?style\=all_docs
{"results":[
{"seq":2,"id":"doc","changes":[{"rev":"1-4c6114c65e295552ab1019e2b046b10e"},{"rev":"1-078e832b49edb2a4b05b6d9ba627ff2f"}]}
],
"last_seq":2}

You may query document with meta=true query parameter to verify that
conflicts are exists for this document:

[~]$ curl http://localhost:5984/conflicts/doc\?meta\=true
{"_id":"doc","_rev":"1-4c6114c65e295552ab1019e2b046b10e","foo":"bar","_revs_info":[{"rev":"1-4c6114c65e295552ab1019e2b046b10e","status":"available"}],"_conflicts":["1-078e832b49edb2a4b05b6d9ba627ff2f"]}

--
,,,^..^,,,


On Mon, Sep 30, 2013 at 12:05 PM, Michael S <mi...@hotmail.de> wrote:
> Hi together,
>
> I am using CouchDB Version 1.4.0 and the Changes Feed, but I have a litte
> problem with the style option
> (http://localhost:5984/db1/_changes?style=all_docs) in the query request.
> The JSON output does not return all leaf revisions in the changes array
> (including conflicts and deleted former conflictes) - which is mentioned in
> the official CouchDB documentation.
>
> Please see my example and the JSON output
> curl -X GET http://localhost:5984/db1/_changes?style=all_docs
> {"results":[
> {"seq":3,"id":"81abd28f263b2046ddfc867247007275","changes":[{"rev":"3-1a796ab41eeb8bafd3d6025a4b31928f"}]}
> ],
> "last_seq":3}
>
> The JSON output is also the same as with style=main_only and I can also
> query all revisions of the document _id
> 81abd28f263b2046ddfc867247007275.....
>
> Is this a known bug?
>
> Michael