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

Inserting a unique value into a specific position in an array

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • None
    • Write Ops
    • None

    Description

      Inserting an item of any type into a specific postion into existing array structure

      Currently $push only appends data to an array.
      But there is no function to insert an array into a specific postion.

      Example data (Python array)

      Before:
      [ [Item1, 0, 0], [Item2, 0, 0].. ] # Array items inside an array

      Command for example can be
      { '$insert':

      { 'myArray.1': [item3, 0,0 ] }

      } # At position 1 of the myArray

      Result:
      [ [Item1, 0,0], [Item3, 0,0], [Item2, 0,0] ]

      $push is out of question as the data should be inserted to keep a order of the items.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jan.rie Jan Riechers
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: