Glynn Bird created COUCHDB-2522:
-----------------------------------

             Summary: CouchDB 2.0 /_changes feed does not return full 
attachment data with attachments=true
                 Key: COUCHDB-2522
                 URL: https://issues.apache.org/jira/browse/COUCHDB-2522
             Project: CouchDB
          Issue Type: Bug
      Security Level: public (Regular issues)
          Components: Database Core
            Reporter: Glynn Bird


In CouchDB 1.6, if a document is created with an attachment, and the _changes 
feed is consumed with '?include_docs=true&attachments=true', the full 
attachments are seen in the feed e.g.:

{Code}
$ curl -X DELETE http://127.0.0.1:5984/test
{"ok":true}
~$ curl -X PUT http://127.0.0.1:5984/test
{"ok":true}
~$ curl -X POST http://127.0.0.1:5984/test -H 'Content-type:application/json' 
-d '{ "id": "bob", "_attachments": { "foo.txt": {"content_type": 
"text/plain","data": "holy moly"} } }'
{"ok":true,"id":"6fb52c4798e6186baf9871ce19000a8d","rev":"1-8ccb83bd8362d56d396fb84e875dcae9"}
~$ curl 
'http://127.0.0.1:5984/test/_changes?include_docs=true&attachments=true'{"results":[
{"seq":1,"id":"6fb52c4798e6186baf9871ce19000a8d","changes":[{"rev":"1-8ccb83bd8362d56d396fb84e875dcae9"}],"doc":{"_id":"6fb52c4798e6186baf9871ce19000a8d","_rev":"1-8ccb83bd8362d56d396fb84e875dcae9","id":"bob","_attachments":{"foo.txt":{"content_type":"text/plain","revpos":1,"digest":"md5-iRNdzYnZ/dk8u44XAJXaAQ==","data":"holymoly"}}}}
],
"last_seq":1}
{Code}

In CouchDB 2.0, only the stub document is returned:

{Code}
~$ curl -X PUT http://127.0.0.1:15984/test
{"ok":true}
~$ curl -X POST http://127.0.0.1:15984/test -H 'Content-type:application/json' 
-d '{ "id": "bob", "_attachments": { "foo.txt": {"content_type": 
"text/plain","data": "holy moly"} } }'
{"ok":true,"id":"fdd888086d37edf3a60c9bfb1c00297d","rev":"1-8ccb83bd8362d56d396fb84e875dcae9"}
~$ curl 
'http://127.0.0.1:15984/test/_changes?include_docs=true&attachments=true'
{"results":[
{"seq":[1,"g1AAAAFxeJzLYWBg4MhgTmHgz8tPSTV0MDQy1zMAQsMcoARTIkOS_P___7MymBMZc4EC7MkWiYamKSaYynEakaQAJJPsQaYkMuBW5QBSFQ-2C2gr2K6kZPPkVMM03HoSQHrqCZicxwIkGRqAFFDhfMIqF0BU7ies8gBE5X3CKh9AVILcmQUAbypgyA"],"id":"fdd888086d37edf3a60c9bfb1c00297d","changes":[{"rev":"1-8ccb83bd8362d56d396fb84e875dcae9"}],"doc":{"_id":"fdd888086d37edf3a60c9bfb1c00297d","_rev":"1-8ccb83bd8362d56d396fb84e875dcae9","id":"bob","_attachments":{"foo.txt":{"content_type":"text/plain","revpos":1,"digest":"md5-iRNdzYnZ/dk8u44XAJXaAQ==","length":6,"stub":true}}}}
],
"last_seq":[1,"g1AAAAGzeJyFz00OgkAMBeD6k-jOI-gJDGWYMKzkJjrtQAhBPILeRG-iN9GbYBETYDEhTV6T13yLVgCwLhYONvXFZZhiGO8DGazkMLdA26ZpymJuZ2cpVmwsahd5Ae0k6fA38DNaZRSz8Zu0NceRIY45w9xvTq25jgyGmBAqr6mXknCTJezeu5AirRKacI_OPXun0CRm0r069x44x9bkesJ9Ojf4jwPUbLH8Ang9bN8"],"pending":0}
{Code}

This causes PouchDB's tests which passed with 1.6 to fail with 2.0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to