incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <jch...@gmail.com>
Subject Re: Erlang Doc structure
Date Thu, 03 Jun 2010 21:33:45 GMT

On Jun 3, 2010, at 2:01 PM, Mike Keen wrote:

> In the same vein, how is a Value item within a reduce function represented in Erlang?
> 

I don't know off the top of my head, but there is the ability to Log to the couch.log file
from within an Erlang view. 

For reference you might see: http://svn.apache.org/repos/asf/couchdb/trunk/share/www/script/test/erlang_views.js
from the test suite.

Chris

> On Jun 3, 2010, at 3:26 PM, J Chris Anderson wrote:
> 
>> 
>> On Jun 3, 2010, at 10:40 AM, Mike Keen wrote:
>> 
>>> I've been playing with Erlang views on and off in CouchDB, and find the information
on the internal Erlang structure of Docs lacking. Is there somewhere I can read up on this?
I had initially assumed that a Doc was a list of tuples, but I am starting to suspect that
I am wrong.
>>> 
>> 
>> It's an erlang proplist, wrapped in a single tuple, so:
>> 
>> {[{<<"key">>, value()}, {<<"other-key">>, value()}]}
>> 
>> Where value() is any valid eJSON.
>> 
>> So you can do eg:
>> 
>> {Props} = Doc,
>> V1 = couch_util:get_value(<<"key">>, Props)
>> 
>>> Mike
>> 
> 


Mime
View raw message