couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Hinrichs - DM&T" <je...@dundeemt.com>
Subject _attachments and thumbprints
Date Thu, 15 Jan 2009 13:25:00 GMT
Is it possible for a user to add calculated attributes to the
_attachments dictionary?  Say I wanted to include the md5 hash of the
attached file.  I realize that this is an expensive operation if you
don't need it so I'm not asking if CouchDB could calc the MD5, but can
I ?

   "_attachments": {
       "PRINV00541302.PDF": {
           "stub": true,
           "content_type": "application/pdf",
           "length": 163502
       },
       "INV00541302.PDF": {
           "stub": true,
           "content_type": "application/pdf",
           "length": 156047
       }
   }

Can I modify via user code to:

   "_attachments": {
       "PRINV00541302.PDF": {
           "stub": true,
           "content_type": "application/pdf",
           "length": 163502,
           "md5": "1ba37b2a936dd5fe1415937c40b2cb02"
       },
       "INV00541302.PDF": {
           "stub": true,
           "content_type": "application/pdf",
           "length": 156047,
           "md5":"72ef73ff5040fcb9c8a90757b21c27eb"
       }
   }

What I am trying to accomplish is determining if I have the file
already in the database, of if the file is different than the one
already stored in couch.  It would be nice to keep it with the
attachment instead of creating a parallel structure to hold the
information.

Regards,

Jeff

Mime
View raw message