@@ -59,12 +59,6 @@ export const CURSOR_FLAGS = [
5959 'partial'
6060] as const ;
6161
62- /** @public */
63- export interface CursorStreamOptions {
64- /** A transformation method applied to each document emitted by the stream */
65- transform ?( this : void , doc : Document ) : Document ;
66- }
67-
6862/** @public */
6963export type CursorFlag = ( typeof CURSOR_FLAGS ) [ number ] ;
7064
@@ -523,7 +517,7 @@ export abstract class AbstractCursor<
523517 }
524518 }
525519
526- stream ( options ?: CursorStreamOptions ) : Readable & AsyncIterable < TSchema > {
520+ stream ( ) : Readable & AsyncIterable < TSchema > {
527521 const readable = new ReadableCursorStream ( this ) ;
528522 const abortListener = addAbortListener ( this . signal , function ( ) {
529523 readable . destroy ( this . reason ) ;
@@ -532,31 +526,6 @@ export abstract class AbstractCursor<
532526 abortListener ?. [ kDispose ] ( ) ;
533527 } ) ;
534528
535- if ( options ?. transform ) {
536- const transform = options . transform ;
537-
538- const transformedStream = readable . pipe (
539- new Transform ( {
540- objectMode : true ,
541- highWaterMark : 1 ,
542- transform ( chunk , _ , callback ) {
543- try {
544- const transformed = transform ( chunk ) ;
545- callback ( undefined , transformed ) ;
546- } catch ( err ) {
547- callback ( err ) ;
548- }
549- }
550- } )
551- ) ;
552-
553- // Bubble errors to transformed stream, because otherwise no way
554- // to handle this error.
555- readable . on ( 'error' , err => transformedStream . emit ( 'error' , err ) ) ;
556-
557- return transformedStream ;
558- }
559-
560529 return readable ;
561530 }
562531
0 commit comments