Skip to content

Commit bddfcf8

Browse files
committed
Ensure cursor IDs are always encoded as 64-bit integers in BSON for get_more and kill_cursors
1 parent 1348278 commit bddfcf8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/mongo/cursor.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ defmodule Mongo.Cursor do
140140
def get_more(_topology_pid, session, coll, cursor, nil, opts) do
141141

142142
cmd = [
143-
getMore: cursor,
143+
getMore: %BSON.LongNumber{value: cursor},
144144
collection: coll,
145145
batchSize: opts[:batch_size],
146146
maxTimeMS: opts[:max_time]
@@ -157,7 +157,7 @@ defmodule Mongo.Cursor do
157157
on_resume_token: fun) = change_stream, opts) do
158158

159159
get_more = [
160-
getMore: cursor_id,
160+
getMore: %BSON.LongNumber{value: cursor_id},
161161
collection: coll,
162162
batchSize: opts[:batch_size],
163163
maxTimeMS: opts[:max_time]
@@ -282,7 +282,7 @@ defmodule Mongo.Cursor do
282282

283283
cmd = [
284284
killCursors: coll,
285-
cursors: cursor_ids
285+
cursors: cursor_ids |> Enum.map(fn id -> %BSON.LongNumber{value: id} end)
286286
] |> filter_nils()
287287

288288
with {:ok, %{"cursorsAlive" => [],

0 commit comments

Comments
 (0)