I have code like this:

index('GET', []) ->
    Users = boss_db:find(consumer, []),
    {json, [{"users", Users}]}.

And I have an error:

{function_clause,
    [{boss_json,json_data1,
         [[{consumer,"consumer-52a3024b4346e12118000001",<<"qwe">>,
               <<"qwe">>},
           {consumer,"consumer-52a302c84346e12118000002",<<"asd">>,
               <<"asd">>},
           {consumer,"consumer-52a305264346e12118000003",<<"zxc">>,
               <<"zxc">>}],
          ["user"],
          []],
         [{file,"src/boss/boss_json.erl"},{line,23}]}

Where is the problem? How to solve it?

有帮助吗?

解决方案

Probably a mistake in the last line, users must be an atom, not a string:

 {json, [{users, Users}]}.
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top