[erlang-questions] How to access CouchDB?

Yves S. Garret <>
Fri Aug 9 21:22:46 CEST 2013


On Fri, Aug 9, 2013 at 12:57 PM, Benoit Chesneau <>wrote:

> not sure if it can help but you can use http://github.com/benoitc/couchcwhich abstract the internal couchdb api .
>
> - benoitc
>
>
> On Friday, August 9, 2013, Yves S. Garret wrote:
>
>> Hello,
>>
>> I have a small database that's running right now in CouchDB, it's called
>> sample_database.  What I'd
>> like to do is to read, create, delete, update documents and run some of
>> the views inside from an
>> Erlang app.  I looked online and found this example:
>>
>> http://www.softwarepassion.com/importing-data-to-couchdb-java-ruby-and-erlang-way/
>>
>> From that, I proceeded to make the following little script:
>> -module(test).
>>
>> -import(queue,[in/1,out/1,new/0]).
>> -export([start/0]).
>> -include("../couch_db.hrl").
>>
>> -define(ADMIN_USER_CTX, {user_ctx, #user_ctx{roles = [<<"_admin">>]}}).
>>
>> start() ->
>>   io:format("Hello world!~n~n"),
>>
>>    couch_db:open(<<"sample_database">>, [?ADMIN_USER_CTX]).
>>
>> However, when I run this, I get the following error:
>> 18> test:start().
>> Hello world!
>>
>> ** exception error: undefined function couch_db:open/2
>>
>> It's obvious I'm not including a library of some sort.  I'm curious how I
>> can connect to my little
>> database in the simplest way possible just to start with.  Has anyone
>> done this before?
>>
>
Thanks.  I believe I've resolved most of my problems already, but this is a
welcome addition to my
little bag of tricks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130809/b81b9a13/attachment.html>


More information about the erlang-questions mailing list