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 19:26:21 GMT

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