-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: 4.1.2
-
Component/s: TypeScript
Hello,
Since typings got added to the library in 4.0 and DefinitelyTyped's typings are no longer needed, this issue (.aggregate assumes the resulting document will be of the same object type as the collection's document) still persists. Here is what is currently being distributed in 4.1.1 (1 of 2 places aggregate is defined):
/**
* Execute an aggregation framework pipeline against the collection, needs MongoDB \>= 2.2
*
* @param pipeline - An array of aggregation pipelines to execute
* @param options - Optional settings for the command
*/
aggregate<T = TSchema>(pipeline?: Document[], options?: AggregateOptions): AggregationCursor<T>;
Updating AggregationCursor<T> to AggregationCursor<unknown> fixes things for me. Alternatively, it may be possible to refactor the AggregationCursor class to not be generic.
Acceptance Criteria
*
- duplicates
-
NODE-2673 aggregate TypeScypt type is incorrect
-
- Closed
-