[erlang-questions] ** exception error: bad argument in function ets:lookup_element/3

raviraj555 raviraj555@REDACTED
Tue Dec 20 13:29:49 CET 2011


Hi All,
I m new in Erlang, when i do the mongodb connection it get connected
successfully but if run any query inside function i m getting
following error

hello_
** exception error: bad argument
     in function  ets:lookup_element/3
        called as ets:lookup_element(mongodb_app,oid_machineprocid,2)
     in call from mongodb_app:gen_objectid/0
     in call from mongo:assign_id/1
     in call from lists:map/2
     in call from mongo:insert_all/2
     in call from mongo:insert/2
     in call from mongo:do/5
     in call from art:run/0



for reference this is my code


run() ->
	 application:start(mongodb),
    {ok, Conn} = mongo:connect({localhost, 27017}),
    {ok, Docs} = mongo:do (safe, master, Conn, test, fun() ->
				io:fwrite("hello_"),
    mongo:delete (foo, {}),
    mongo:insert (foo, {x,1, y,2}),
    mongo:find (foo, {x,1}) end),

    mongo:disconnect (Conn).



More information about the erlang-questions mailing list