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

not allowed to $push and $pop to same field in same update

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor - P4
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0
    • Fix Version/s: planned but not scheduled
    • Component/s: Write Ops
    • Labels:
      None

      Description

      Was just talking about #991 with Dwight and noticed that you can't workaround by doing $push / $pop to the same field on the same update, for example:

      > db.test.drop();
      false
      > db.test.save(

      { mylist: [1,2] }

      );
      > db.test.update( {}, { $push:

      { mylist: 3 }

      , $pop:

      { mylist: -1 }

      } );
      Field name duplication not allowed with modifiers

      Would be nice if this was permitted.

        Issue Links

          Activity

          Hide
          brg2 Brett added a comment -

          This would be very helpful when trying to move sub objects from one array to another.

          Show
          brg2 Brett added a comment - This would be very helpful when trying to move sub objects from one array to another.
          Hide
          rwander Roman added a comment -

          +1

          Show
          rwander Roman added a comment - +1
          Hide
          ismetozalp Ismet Ozalp added a comment -

          This type of issues, always requires workarounds, most of the time these workarounds are ending up with ugly solutions.

          Just like this one these are all 5 year issues.
          https://jira.mongodb.org/browse/SERVER-1243
          https://jira.mongodb.org/browse/SERVER-1920
          Just like them i am going to watch this issue, hope for someday it will be fixed.

          +1

          Show
          ismetozalp Ismet Ozalp added a comment - This type of issues, always requires workarounds, most of the time these workarounds are ending up with ugly solutions. Just like this one these are all 5 year issues. https://jira.mongodb.org/browse/SERVER-1243 https://jira.mongodb.org/browse/SERVER-1920 Just like them i am going to watch this issue, hope for someday it will be fixed. +1
          Hide
          markbigler Mark Bigler added a comment -

          +1

          Show
          markbigler Mark Bigler added a comment - +1
          Hide
          blabergri@amadeus.com Benoit Labergri added a comment -

          Quit similar requierment for us : conditional $pull (on sub document field in the array) and non conditional $push in the same update on the same array.

          Show
          blabergri@amadeus.com Benoit Labergri added a comment - Quit similar requierment for us : conditional $pull (on sub document field in the array) and non conditional $push in the same update on the same array.

            People

            • Votes:
              154 Vote for this issue
              Watchers:
              104 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since reply:
                5 weeks, 1 day ago
                Date of 1st Reply: