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 @@ -306,7 +306,10 @@ export abstract class AbstractCursor<
306
306
while ( true ) {
307
307
const document = await this . next ( ) ;
308
308
309
- if ( document == null ) {
309
+ // Intentional strict null check, because users can map cursors to falsey values.
310
+ // We allow mapping to all values except for null.
311
+ // eslint-disable-next-line no-restricted-syntax
312
+ if ( document === null ) {
310
313
if ( ! this . closed ) {
311
314
const message =
312
315
'Cursor returned a `null` document, but the cursor is not exhausted. Mapping documents to `null` is not supported in the cursor transform.' ;
@@ -777,7 +780,10 @@ export function next<T>(
777
780
// All cursors must operate within a session, one must be made implicitly if not explicitly provided
778
781
cursor [ kInit ] ( ( err , value ) => {
779
782
if ( err ) return callback ( err ) ;
780
- if ( value != null ) {
783
+ // Intentional strict null check, because users can map cursors to falsey values.
784
+ // We allow mapping to all values except for null.
785
+ // eslint-disable-next-line no-restricted-syntax
786
+ if ( value !== null ) {
781
787
return callback ( undefined , value ) ;
782
788
}
783
789
return next ( cursor , blocking , callback ) ;
You can’t perform that action at this time.
0 commit comments