benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 114 forks source link

couchbeam:savedoc/2 doesn't work without couchbeam:start() #51

Closed DimitryDushkin closed 13 years ago

DimitryDushkin commented 13 years ago

So, my new programm is

db() ->
    st_utils:load_libraries(),
    application:start(sasl),
    application:start(ibrowse),
    application:start(couchbeam),
    Server = couchbeam:server_connection("localhost", 5984, "", []),
    {ok, Db} = couchbeam:open_or_create_db(Server, "site_stater", []),
    Doc = {[
            {<<"url">>, <<"http://sky2high.net">>}
            ]},
    {ok, DocResult} = couchbeam:save_doc(Db, Doc),
    io:format("~p", [DocResult]). 

but it gives the error:

** exception exit: {noproc,
                       {gen_server,call,
                           [couchbeam,
                            {get_uuids,{server,"localhost",5984,[],[]},1}]}}
     in function  gen_server:call/2
     in call from couchbeam:save_doc/3
     in call from st_site_checker:db/0

if I do not use couchbeam:start(), after application:start(couchbeam),.

I did something wrong (again %) ) or it just hasn't been mentioned in manual?

benoitc commented 13 years ago

That's expected behaviour. Since couchbeam is an OTP application you have to start it. This is explained in getting started doc :)