File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -120,8 +120,8 @@ export class AggregationCursor<TSchema = Document> extends AbstractCursor<TSchem
120
120
return this ;
121
121
}
122
122
123
- /** Add a out stage to the aggregation pipeline */
124
- out ( $out : number ) : this {
123
+ /** Add an out stage to the aggregation pipeline */
124
+ out ( $out : string ) : this {
125
125
assertUninitialized ( this ) ;
126
126
this [ kPipeline ] . push ( { $out } ) ;
127
127
return this ;
Original file line number Diff line number Diff line change 1
- import { expectType , expectDeprecated } from 'tsd' ;
1
+ import { expectType , expectDeprecated , expectError } from 'tsd' ;
2
2
import { MongoClient } from '../../src/mongo_client' ;
3
3
import { Collection } from '../../src/collection' ;
4
4
import { AggregationCursor } from '../../src/cursor/aggregation_cursor' ;
@@ -35,3 +35,7 @@ const composedMap = mappedAgg.map<string>(x => x.toString());
35
35
expectType < AggregationCursor < string > > ( composedMap ) ;
36
36
expectType < string | null > ( await composedMap . next ( ) ) ;
37
37
expectType < string [ ] > ( await composedMap . toArray ( ) ) ;
38
+
39
+ const builtCursor = coll . aggregate ( ) ;
40
+ expectType < AggregationCursor < Document > > ( builtCursor . out ( 'string' ) ) ; // should allow string values for the out helper
41
+ expectError ( builtCursor . out ( 1 ) ) ; // should error on non-string values
You can’t perform that action at this time.
0 commit comments