Details
-
Improvement
-
Resolution: Fixed
-
Major - P3
-
None
-
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)
Description
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]
|
Attachments
Issue Links
- depends on
-
SERVER-59303 Support limit expression for $filter in SBE
-
- Closed
-
- is documented by
-
DOCS-14896 Investigate changes in SERVER-32739: allow limit in $filter expression
-
- Closed
-
- is related to
-
SERVER-25957 Optimize $filter + $arrayElemAt to avoid scanning entire array
-
- Backlog
-