[英]Unable to execute mongo:find function in erlang
Using mongodb erlang driver my program able to connect mongodb database server. 使用mongodb erlang驱动程序,我的程序能够连接mongodb数据库服务器。 After successful connection I tried to all the documents present in the collection.
成功连接之后,我尝试了集合中存在的所有文档。
I tried the below code: 我尝试了以下代码:
mongo:do (safe, master, Conn, graph, fun() ->
process(mongo:find (pedgedata0, {src,1})) end),
here 'graph' is dbname and 'pedgedata0' is collection. 这里的“ graph”是dbname,“ pedgedata0”是集合。
I tried with different options like 我尝试了不同的选择
mongo:do (safe, master, Conn, 'graph', fun() ->
process(mongo:find ('pedgedata0', {})) end),
* here I tried with single quotes for db and collection name and also specified an empty condition. *在这里,我尝试对数据库名称和集合名称使用单引号,并且还指定了一个空条件。
However I am getting below error: 但是我得到以下错误:
Conn is : <0.104.0>
** exception exit: undef
in function bson_binary:put_cstring/1
called as bson_binary:put_cstring(<<"graph.pedgedata0">>)
in call from mongo_protocol:put_message/3
in call from mongo_connection:encode_request/2
in call from mongo_connection:handle_call/3
in call from gen_server:handle_msg/5
in call from proc_lib:init_p_do_apply/3
I am running this program from erlide(Eclipse addon for erlang). 我正在从erlide(用于erlang的Eclipse插件)运行此程序。
Please help me to resolve this problem 请帮我解决这个问题
请使用更新版本的驱动程序: https : //github.com/comtihon/mongodb-erlang有更新的mongo操作接口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.