我正在尝试了解 boss_db 模块以访问我在芝加哥老板设置的 mongodb
我从这里找到了一个使用 boss_db 访问该数据的示例
例子:
Puppy = boss_db:find("puppy-1"),
io:format("Puppy's name: ~p~n", [Puppy:name()]).
但是当我用我的代码尝试这一切时
Cl= boss_db:find(clientList, [], [{limit,1}]),
io:format("Puppy's name: ~p~n", [Cl:datablock()]),
我收到此错误消息
[{erlang,apply,
[[{clientList,"clientList-53e30e8b10af5d1503000287",
<<"Sheet1">>,<<"Jason@email.com.au\n">>,
<<131,108,0,0,0,3,104,2,107,0,6,70,105,101,108,100,49,
107,...>>}],
datablock,[]],
[]},
{pigeon_greeting_controller,template,3,
[{file,
"/home/jason/pigeon/src/controller/pigeon_greeting_controller.erl"},
{line,57}]},
{boss_web_controller,call_controller_action,3,
[{file,"src/boss/boss_web_controller.erl"},{line,363}]},
{boss_web_controller,apply_action,4,
[{file,"src/boss/boss_web_controller.erl"},{line,355}]},
{boss_web_controller,execute_action_inner,9,
[{file,"src/boss/boss_web_controller.erl"},{line,334}]},
{boss_web_controller_handle_request,process_dynamic_request,
4,
[{file,"src/boss/boss_web_controller_handle_request.erl"},
{line,242}]},
{boss_web_controller_handle_request,process_request,4,
[{file,"src/boss/boss_web_controller_handle_request.erl"},
{line,228}]},
{boss_web_controller_handle_request,set_timer,7,
[{file,"src/boss/boss_web_controller_handle_request.erl"},
{line,148}]}]
我知道我收到了返回的数据,因为我可以做到
[{clientList, _,_,_, Datablock}] = boss_db:find(clientList, [], [{limit,1}]),
io:format("data block is : ~p~n", [Datablock]).
它回来没有问题
我的偏好是通过字段名称而不是模式匹配来查找它,因为模式可能会在某些时候发生变化。
我是在看旧的例子,还是这个例子只适用于关系数据库。我很难找到有一些关于如何做到这一点的简单示例的网站