File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 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
121121 }
122122
123123 /** Add an out stage to the aggregation pipeline */
124- out ( $out : string ) : this {
124+ out ( $out : { db : string ; coll : string } | string ) : this {
125125 assertUninitialized ( this ) ;
126126 this [ kPipeline ] . push ( { $out } ) ;
127127 return this ;
Original file line number Diff line number Diff line change @@ -37,5 +37,11 @@ expectType<string | null>(await composedMap.next());
3737expectType < string [ ] > ( await composedMap . toArray ( ) ) ;
3838
3939const 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