Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-32739

allow limit in $filter expression

    • 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

      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]
      

            Assignee:
            maddie.zechar@mongodb.com Maddie Zechar
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: