-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: TypeScript
Currently the stages of an aggregation pipeline are loosely or incorrectly typed. The signature of the "aggregate" method uses a "T extends Document = Document" template parameter which turns into "any". I couldn't make out what Document is in this context, but I believe it should be a union with all the possible aggregation operators instead.
If for some reason this typing is hard to implement, is still possible to make the type less loose (the pipeline stage will always consist of a object with a single key in it, the key starting with a dollar sign and being a valid aggregation operator).
I have a running code base which makes extensive use of aggregations, and a lot of trouble could be saved during the build time. It's not anything urgent, but I think such relatively easy improvement could be made into the next release.
Let me know if I could help any further by opening a PR. Thanks!
- is related to
-
NODE-5863 Atlas Search aggregation pipeline TypeScript type definitions
- Backlog