couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "armin weisser" <armin.weis...@virtual-identity.com>
Subject AW: emit attachments
Date Thu, 19 May 2011 09:45:04 GMT
Hey Gabor,

shame on me. It's so simple! ;)
Thanks.

Cheers,
Armin

-----Urspr√ľngliche Nachricht-----
Von: Gabor Ratky [mailto:rgabo@rgabostyle.com] 
Gesendet: Donnerstag, 19. Mai 2011 09:59
An: user@couchdb.apache.org
Betreff: Re: emit attachments

Armin,

function(doc) {
if (doc._attachments) {
 for (var name in doc._attachments) {
 emit([doc._id, name], doc._attachments[name]);  } } }

for (var i in ...) iterates over they keys, which are the names of the attachments in doc._attachments.

Gabor
On Thursday, May 19, 2011 at 9:13 AM, armin weisser wrote:
Hi guys,
> 
> 
> 
> is there a way to emit the names of all _attachments? 
> 
> 
> 
> I found this one in the archive
> 
> http://couchdb.markmail.org/search/?q=_attachments+emit+name#query:_at
> ta chments%20emit%20name+page:1+mid:ybbhvtlqa6rfqlgc+state:results
> 
> but still I'm not sure how to emit a name of an attachment.
> 
> 
> 
> What I want to do is something like this
> 
> 
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~snip
> 
> function(doc) {
> 
>  for ( var i in doc._attachments) {
> 
>  emit([doc._id, 'attachment name'], doc._attachments[i]);
> 
>  }
> 
> }
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~snap
> 
> 
> 
> where 'attachment name' should be replaced by the name of the 
> attachment.
> 
> 
> 
> Cheers,
> 
> 
> 
> Armin
> 
Mime
View raw message