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

$push and $addToSet should have a $limit modifier

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Write Ops
    • Labels:
      None

      Description

      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).

        Attachments

          Activity

            People

            • Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: