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

$push and $addToSet should have a $limit modifier

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Write Ops
    • Labels:
      None
    • Query

      I believe on top of $slice that lets you control the size of the resulting array, there should be a modifier that allows Mongo to return an error when the resulting array size would exceed a certain limit.

      $slice is nice when you can afford to lose the docs that didn't "make it" to the final array.

      $limit (or whatever we call it) would be nice because an application could capture an exception when updating an array with too many items and then act on it in a smarter way than just dropping some items (which $slice already provides).

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            wojcikstefan Stefan Wójcik
            Votes:
            3 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: