Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix for mongodb cursor #34

zephyrean opened this Issue Mar 20, 2013 · 1 comment


None yet
2 participants

zephyrean commented Mar 20, 2013

There's a minor bug that prevents working with cursors and I have a fix for it:
getMore function clause from mongoapi.erl for the case when Rec is just a collection name

getMore(Rec, Cursor) when is_list(Rec); is_binary(Rec) ->

is identical to another clause and doesn't work.
So line numbers 297-300:

{done, Result} ->
    {done, mongodb:decoderec(Rec, Result)};
{ok, Result} ->
    {ok, mongodb:decoderec(Rec, Result)}

should be replaced with:

{done, Result} ->
    {done, mongodb:decode(Result)};
{ok, Result} ->
    {ok, mongodb:decode(Result)}

Also in erlmongo.hrl there's QUER_OPT_CURSOR constant that is set to 2 which is not correct. This option should only be set for tailable cursors (and by the way in current mongodb version this constant is changed to 1). But tailable cursors are only for capped collections. So to use it with normal collections you need to either set it to 0 or do not add it in mongoapi:cursor functions at all.


SergejJurecko commented Mar 20, 2013

Pushed change. Thank you for the report.

@zephyrean zephyrean closed this Jul 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment