checkiz / elixir-mongo

MongoDB driver for Elixir
MIT License
101 stars 31 forks source link

Find only returns 101 results if batch size is not specified #28

Closed tbohnen closed 9 years ago

tbohnen commented 9 years ago

With the below test(add to mongo_cursor_test) you can see that when you don't specify a batch count, or the batch count is specified as zero, then it only returns the first 101 items in the find query

test "Correct count is returned if more than 100 items are queried with no batch size specified or batchSize zero", ctx do
  anycoll = ctx[:anycoll]

  Mongo.Collection.drop anycoll

  items = 1..110 |> Enum.map fn r -> %{a: r, value: r} end

  Mongo.Collection.insert(items, anycoll)

  assert ctx[:anycoll] |> Mongo.Collection.find |> Enum.to_list |> Enum.count == 110
  assert ctx[:anycoll] |> Mongo.Collection.find |> Map.put(:batchSize, 0) |> Enum.to_list |> Enum.count == 110

end
tbohnen commented 8 years ago

Awesome, thanks for the fix!