File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -295,7 +295,10 @@ export abstract class AbstractCursor<
295
295
while ( true ) {
296
296
const document = await this . next ( ) ;
297
297
298
- if ( document == null ) {
298
+ // Intentional strict null check, because users can map cursors to falsey values.
299
+ // We allow mapping to all values except for null.
300
+ // eslint-disable-next-line no-restricted-syntax
301
+ if ( document === null ) {
299
302
if ( ! this . closed ) {
300
303
const message =
301
304
'Cursor returned a `null` document, but the cursor is not exhausted. Mapping documents to `null` is not supported in the cursor transform.' ;
@@ -774,7 +777,10 @@ export function next<T>(
774
777
// All cursors must operate within a session, one must be made implicitly if not explicitly provided
775
778
cursor [ kInit ] ( ( err , value ) => {
776
779
if ( err ) return callback ( err ) ;
777
- if ( value != null ) {
780
+ // Intentional strict null check, because users can map cursors to falsey values.
781
+ // We allow mapping to all values except for null.
782
+ // eslint-disable-next-line no-restricted-syntax
783
+ if ( value !== null ) {
778
784
return callback ( undefined , value ) ;
779
785
}
780
786
return next ( cursor , blocking , callback ) ;
You can’t perform that action at this time.
0 commit comments