From b7183eb76b2b9fd62acc119b127ebd82c202699a Mon Sep 17 00:00:00 2001 From: Ali Sabil Date: Fri, 1 Mar 2013 15:50:18 +0100 Subject: [PATCH] Do not stop the cursor process before the batch is empty --- src/mongo_cursor.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mongo_cursor.erl b/src/mongo_cursor.erl index 394c8b67..5b7f7f08 100644 --- a/src/mongo_cursor.erl +++ b/src/mongo_cursor.erl @@ -118,7 +118,7 @@ handle_call(rest, _From, State) -> handle_call({rest, Limit}, _From, State) -> case rest_i(State, Limit) of - {Reply, #state{cursor = 0} = UpdatedState} -> + {Reply, #state{cursor = 0, batch = []} = UpdatedState} -> {stop, normal, Reply, UpdatedState}; {Reply, UpdatedState} -> {reply, Reply, UpdatedState}