[erlang-questions] How to access CouchDB?

Yves S. Garret <>
Fri Aug 9 03:38:32 CEST 2013


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130808/ef700679/attachment.html>


More information about the erlang-questions mailing list