MongoDB
 sql >> Base de Dados >  >> NoSQL >> MongoDB

A consulta retorna o resultado errado usando o driver mongdb erlang?


Funciona para mim no exemplo abaixo
run () ->
    application:start (mongodb),
    {ok, Conn} = mongo:connect (localhost),
    {ok, Docs} = mongo:do (safe, master, Conn, test, fun() ->
        mongo:delete (foo, {}),
        mongo:insert_all (foo, [{x,1}, {x,2}, {x,3}, {x,0}, {x,-1}]),
        Cur = mongo:find (foo, {'$query', {}, '$orderby', {x,1}}, {'_id',0}, 0, 3),
        mongo:rest (Cur) end),
    mongo:disconnect (Conn),
    [{x,-1}, {x,0}, {x,1}] = Docs.