Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit 7c76c62

Browse files
committed
fix(cursor): check for session presence independently
The current check for sessiosn will not be executed if `promoteLongs` is present. It should check explicitly, outside of the branch.
1 parent 8eee142 commit 7c76c62

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/sdam/cursor.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ class Cursor {
9191
transforms: options.transforms
9292
};
9393

94+
if (typeof options.session === 'object') {
95+
this.s.session = options.session;
96+
}
97+
9498
// Add promoteLong to cursor state
9599
if (typeof topologyOptions.promoteLongs === 'boolean') {
96100
this.s.promoteLongs = topologyOptions.promoteLongs;
97101
} else if (typeof options.promoteLongs === 'boolean') {
98102
this.s.promoteLongs = options.promoteLongs;
99-
} else if (typeof options.session === 'object') {
100-
this.s.session = options.session;
101103
}
102104

103105
// Add promoteValues to cursor state

0 commit comments

Comments
 (0)