File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 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<
295295 while ( true ) {
296296 const document = await this . next ( ) ;
297297
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 ) {
299302 if ( ! this . closed ) {
300303 const message =
301304 '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>(
774777 // All cursors must operate within a session, one must be made implicitly if not explicitly provided
775778 cursor [ kInit ] ( ( err , value ) => {
776779 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 ) {
778784 return callback ( undefined , value ) ;
779785 }
780786 return next ( cursor , blocking , callback ) ;
You can’t perform that action at this time.
0 commit comments