@@ -44,7 +44,6 @@ function AggregationCursor(agg) {
44
44
const model = agg . _model ;
45
45
delete agg . options . cursor . useMongooseAggCursor ;
46
46
this . _mongooseOptions = { } ;
47
- this . options = { } ;
48
47
49
48
_init ( model , this , agg ) ;
50
49
}
@@ -58,25 +57,21 @@ util.inherits(AggregationCursor, Readable);
58
57
function _init ( model , c , agg ) {
59
58
if ( ! model . collection . buffer ) {
60
59
model . hooks . execPre ( 'aggregate' , agg , function ( ) {
61
- Object . assign ( c . options , agg . _optionsForExec ( ) ) ;
62
-
63
60
if ( typeof agg . options ?. cursor ?. transform === 'function' ) {
64
61
c . _transforms . push ( agg . options . cursor . transform ) ;
65
62
}
66
63
67
- c . cursor = model . collection . aggregate ( agg . _pipeline , c . options || { } ) ;
64
+ c . cursor = model . collection . aggregate ( agg . _pipeline , agg . options || { } ) ;
68
65
c . emit ( 'cursor' , c . cursor ) ;
69
66
} ) ;
70
67
} else {
71
68
model . collection . emitter . once ( 'queue' , function ( ) {
72
69
model . hooks . execPre ( 'aggregate' , agg , function ( ) {
73
- Object . assign ( c . options , agg . _optionsForExec ( ) ) ;
74
-
75
70
if ( typeof agg . options ?. cursor ?. transform === 'function' ) {
76
71
c . _transforms . push ( agg . options . cursor . transform ) ;
77
72
}
78
73
79
- c . cursor = model . collection . aggregate ( agg . _pipeline , c . options || { } ) ;
74
+ c . cursor = model . collection . aggregate ( agg . _pipeline , agg . options || { } ) ;
80
75
c . emit ( 'cursor' , c . cursor ) ;
81
76
} ) ;
82
77
} ) ;
0 commit comments