刚开始研究mongodb与erlang的连接方法,希望不要因为问题太弱智,不理我

硪鑀扯蛋 发布于 2013/03/06 17:24
阅读 1K+
收藏 0

ubuntu下,mongodb服务是1.6.3版本的,下载Mongrel 之后,按照相应操作,执行到下面代码报错误

mongrel:do(safe, master, Conn, mongrel_books, fun() ->
 9> mongrel:insert(#book{title = <<"Biggles Combs his Hair">>}) end).

=ERROR REPORT==== 6-Mar-2013::16:46:21 ===
** Generic server <0.94.0> terminating 
** Last message in was {do,#Fun<erl_eval.20.77953630>}
** When Server state == {mongrel_connection,mongrel_books,
                            {connection,{"localhost",27017},<0.72.0>,infinity},
                            safe,master}
** Reason for termination == 
** {bad_return_value,"_id field not set in record of type book"}
** exception exit: {bad_return_value,"_id field not set in record of type book"}

另外,我在下载mongodb模块,在编译mongo.erl的时候出现了adduser方法的中 system.users中"."引起的错误

%% -spec add_user (permission(), username(), password()) -> ok. % Action
%% %@doc Add user with given access rights (permission)
add_user (Permission, Username, Password) ->
    User = case find_one (system.users, {user, Username}) of {} -> {user, Username}; {Doc} -> Doc end,
    Rec = {readOnly, case Permission of read_only -> true; read_write -> false end, pwd, pw_hash                 (Username, Password)},
    save (system.users, bson:merge (Rec, User)).

我想问问,是不是因为我mongodb版本太低的原因造成的吗?



加载中
0
Jcrom
Jcrom
如果这表示的是一个原子,请用单引号括起来·····
返回顶部
顶部