-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Closed
Copy link
Labels
typescriptTypes or Types-test related issue / Pull RequestTypes or Types-test related issue / Pull Request
Milestone
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Mongoose version
6.13.8
Node.js version
22.12.0
MongoDB server version
6.0.17
Typescript version (if applicable)
5.7.2
Description
MongoDB 5.2 introduced several new accumulation operators, including $top, $topN, $firstN, $lastN, $minN and $maxN. While $top and $topN work as expected, the other operators currently cause TypeScript errors when used with Mongoose.
Steps to Reproduce
Query:
GameEntry.aggregate([
{
$sort: { score: -1 }
},
{
$group: {
_id: '$gameId',
maxScores: {
$firstN: { input: '$score', n: 3 }
}
}
]);
Error:
Object literal may only specify known properties, and $firstN does not exist in type AccumulatorOperator
Expected Behavior
Expected $firstN, $lastN, $minN, $maxN, $bottom and $bottomN to be supported as aggregation operators on v6(v7 might be needed too).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
typescriptTypes or Types-test related issue / Pull RequestTypes or Types-test related issue / Pull Request