File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ export class AggregationCursor<TSchema = Document> extends AbstractCursor<TSchem
121
121
}
122
122
123
123
/** Add an out stage to the aggregation pipeline */
124
- out ( $out : string ) : this {
124
+ out ( $out : { db : string ; coll : string } | 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 @@ -37,5 +37,11 @@ expectType<string | null>(await composedMap.next());
37
37
expectType < string [ ] > ( await composedMap . toArray ( ) ) ;
38
38
39
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
40
+ // should allow string values for the out helper
41
+ expectType < AggregationCursor < Document > > ( builtCursor . out ( 'collection' ) ) ;
42
+ // should also allow an object specifying db/coll (as of MongoDB 4.4)
43
+ expectType < AggregationCursor < Document > > ( builtCursor . out ( { db : 'db' , coll : 'collection' } ) ) ;
44
+ // should error on other object shapes
45
+ expectError ( builtCursor . out ( { other : 'shape' } ) ) ;
46
+ // should error on non-object, non-string values
47
+ expectError ( builtCursor . out ( 1 ) ) ;
You can’t perform that action at this time.
0 commit comments