On Mon, Apr 12, 2010 at 10:45 PM, Cesar Delgado <[email protected]> wrote:

> I'd love to just have a new JSON oabject as the value and no key.
>
> function(doc) {
>  var hash = md5(doc.passwd) ;
>  doc.insertmefunct("hash",hash) ;
>  emit(null,doc) ;
> }
>
> would produce:
>
> {"name":"cesar", 
> "passwd":"insecure","hash":"f166786326d565962e8523266c0e1d57"}

doc is just a plain old JavaScript object:

   doc.hash = hash;

should do the trick. Of course, this is only a view output and is not
modifying the original document in the database.

Reply via email to