You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Gert Cuykens <ge...@gmail.com> on 2011/09/23 03:29:54 UTC

_show functions

1) How do you overwrite the ETag of a show function?
I tried this but does not work.
return {headers:{'Content-Type':'text/html','Etags':doc._rev},body:'...'}

2) Can you use the show function to show the content of a binary attachment?

Re: _show functions

Posted by Gert Cuykens <ge...@gmail.com>.
On Fri, Sep 23, 2011 at 4:54 AM, Sean Copenhaver
<se...@gmail.com> wrote:
> 1) To my knowledge you don't have any control over this... but I want to say there is a discussion or some work being done to allow for more control over ETag generation. I had originally thought a _show function's ETag was simply the document's (based on revision hash I think) but the Wiki shows it's a bit more complex then that:
>
> https://wiki.apache.org/couchdb/Formatting_with_Show_and_List#ETags

I need the original ETag in the header for conflicts like with all
other non show documents

> 2) Not entirely sure what you are asking. To retrieve an attachment you just retrieve it off the document. Something like http://server/db/docid/attachmentid
>
> Are you trying to embed an attachment's data into the _show's results? I don't think that is possible as you are only given access to the document requested which will only have the attachment stubs.

Yes, making attachments more dynamic but I can program around it. Not important.

Re: _show functions

Posted by Sean Copenhaver <se...@gmail.com>.
1) To my knowledge you don't have any control over this... but I want to say there is a discussion or some work being done to allow for more control over ETag generation. I had originally thought a _show function's ETag was simply the document's (based on revision hash I think) but the Wiki shows it's a bit more complex then that:

https://wiki.apache.org/couchdb/Formatting_with_Show_and_List#ETags

2) Not entirely sure what you are asking. To retrieve an attachment you just retrieve it off the document. Something like http://server/db/docid/attachmentid

Are you trying to embed an attachment's data into the _show's results? I don't think that is possible as you are only given access to the document requested which will only have the attachment stubs.

-- 
Sean Copenhaver


Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Thursday, September 22, 2011 at 9:29 PM, Gert Cuykens wrote: 
> 1) How do you overwrite the ETag of a show function?
> I tried this but does not work.
> return {headers:{'Content-Type':'text/html','Etags':doc._rev},body:'...'}
> 
> 2) Can you use the show function to show the content of a binary attachment?