I am not seeing the same behaviour.
iex(1)> Mongo.find(pid, "coll", %{}) |> Enum.to_list
[
%{"_id" => #BSON.ObjectId<5e8f5cd37f1ab13c7b1d99a9>, "coll" => 1},
%{"_id" => #BSON.ObjectId<5e8f5cd67f1ab13c7b1c6ea3>, "coll" => 2},
%{"_id" => #BSON.ObjectId<5e8f5cd87f1ab13c7b8e3b4a>, "coll" => 5},
%{"_id" => #BSON.ObjectId<5e8f5cd97f1ab13c7b686cc8>, "coll" => 3},
%{"_id" => #BSON.ObjectId<5e8f5cdc7f1ab13c7bdb8c4c>, "coll" => 7},
%{"_id" => #BSON.ObjectId<5e8f5ce17f1ab13c7b6ebc61>, "coll" => 8},
%{"_id" => #BSON.ObjectId<5e8f5ce37f1ab13c7bae3a15>, "coll" => 10},
%{"_id" => #BSON.ObjectId<5e8f5ce57f1ab13c7b2069ea>, "coll" => 9},
%{"_id" => #BSON.ObjectId<5e8f5cea7f1ab13c7b1f336f>, "coll" => 4},
%{"_id" => #BSON.ObjectId<5e8f5d0c7f1ab13c7b5b4023>, "coll" => 6}
]
iex(2)> limit = 5
5
iex(3)> page = 1
1
iex(4)> skip = (page - 1) * limit
0
iex(5)> Mongo.find(pid, "coll", %{}, limit: limit, skip: skip, sort: [coll: 1]) |> Enum.to_list
[
%{"_id" => #BSON.ObjectId<5e8f5cd37f1ab13c7b1d99a9>, "coll" => 1},
%{"_id" => #BSON.ObjectId<5e8f5cd67f1ab13c7b1c6ea3>, "coll" => 2},
%{"_id" => #BSON.ObjectId<5e8f5cd97f1ab13c7b686cc8>, "coll" => 3},
%{"_id" => #BSON.ObjectId<5e8f5cea7f1ab13c7b1f336f>, "coll" => 4},
%{"_id" => #BSON.ObjectId<5e8f5cd87f1ab13c7b8e3b4a>, "coll" => 5}
]
iex(6)> page = 2
2
iex(7)> skip = (page - 1) * limit # Make sure you are setting the proper value for skip each time.
5
iex(8)> Mongo.find(pid, "coll", %{}, limit: limit, skip: skip, sort: [coll: 1]) |> Enum.to_list
[
%{"_id" => #BSON.ObjectId<5e8f5d0c7f1ab13c7b5b4023>, "coll" => 6},
%{"_id" => #BSON.ObjectId<5e8f5cdc7f1ab13c7bdb8c4c>, "coll" => 7},
%{"_id" => #BSON.ObjectId<5e8f5ce17f1ab13c7b6ebc61>, "coll" => 8},
%{"_id" => #BSON.ObjectId<5e8f5ce57f1ab13c7b2069ea>, "coll" => 9},
%{"_id" => #BSON.ObjectId<5e8f5ce37f1ab13c7bae3a15>, "coll" => 10}
]
Would you be able to show something similar to what I just did there? If you can, I may be able to help figure out what is going wrong.