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

$push with $slice + $sort

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 2.3.2
    • Write Ops
    • None

    Description

      You can now limit the resulting elements in the array after you push. The new syntax is :

      db.coll.update({...}, {$push: { $each:[<values>], $slice:-N, $sort:{...}}}

      The initial implementation (see SERVER-8069 for more) only supports negative slice (taking stuff from the end of the array).

      Sorting is by embedded document fields and doesn't work any type which is not an embedded docs (in the array).

      Attachments

        Issue Links

          Activity

            Dates

              Created:
              Updated:
              Resolved: