Skip to content

Commit 324e793

Browse files
committed
fix(CursorResponse): update id getter to ensure cursorId is always retrieved
- Modified the id getter to require the cursor id to be present, removing the defaulting to 0. - This change enhances the reliability of cursor handling by ensuring that a valid cursor id is always returned, improving overall response accuracy.
1 parent e1a8678 commit 324e793

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cmap/wire_protocol/responses.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ export class CursorResponse extends MongoDBResponse {
248248

249249
public get id(): Long {
250250
try {
251-
const cursorId = this.cursor.get('id', BSONType.long, false);
252-
return cursorId ? Long.fromBigInt(cursorId) : Long.fromBigInt(0n);
251+
const cursorId = this.cursor.get('id', BSONType.long, true);
252+
return Long.fromBigInt(cursorId);
253253
} catch (cause) {
254254
throw new MongoUnexpectedServerResponseError(cause.message, { cause });
255255
}

0 commit comments

Comments
 (0)