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

$push() to front of array

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

      Currently $push() only pushes items onto the end of the array.
      It would be nice if we could pass an optional boolean parameter that would allow pushing to the front of the array instead.

      This would allow reversing the order of arrays by nature of the front-push update, and would eliminate the need to do any client side sorting or reversing.
      Currently adding array items atomically in reverse chronological order is not possible.

      This is similar to SERVER-2036, and having an $insert() would accomplish the same thing.
      But more specific and easier.

            scotthernandez Scott Hernandez (Inactive)
            sym3tri Ed Rooth
            8 Vote for this issue
            11 Start watching this issue