I have a document properties downloaded from a view, so I have the actual JSON from the doc, including the ID and Rev ID. I don't have the actual CouchDocument, though.
The document has an attachment, and I know the name of it. I'm trying to download the attachment into a CouchAttachment object, but I can't find a way of doing it without having to redownload the document, which is slow. Here's what I'm doing:
-(CouchAttachment *)getAttachmentFor:(NSObject *)doc named:(NSString *)fileName {
if ([[doc valueForKey:@"_attachments"] valueForKey:fileName]==nil)
return nil;
CouchDocument * document = [[[App shared] database] documentWithID:[doc valueForKey:@"_id"]];
CouchRevision * revision = [document revisionWithID:[doc valueForKey:@"_rev"]];
return [revision attachmentNamed:fileName];
}
Is there any way to get the Attachment directly, wihout having to first get the doc and revision?