-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Fully Compatible
-
QO 2021-09-06, Query Optimization 2021-08-09, QO 2021-09-20, QO 2021-10-04, QO 2021-10-18, QO 2021-11-01, QO 2021-08-23
-
(copied to CRM)
Currently $filter expression will return all matching array elements of its input.
This is a request to add a "limit" option which caps the number of matches returned.
{$filter:{ input:[1,2,3,10,11,12,15], cond:{$lt:["$$this", 13]}, limit: 2 }} // result [1,2]
- depends on
-
SERVER-59303 Support limit expression for $filter in SBE
- Closed
- is related to
-
SERVER-25957 Optimize $filter + $arrayElemAt to avoid scanning entire array
- Backlog