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
          esroberts Eric Roberts added a comment -

          Similar scenario as Kevin Rice. I need to upsert a variable amount of values into arrays but pad to a default max in a single call.

          Show
          esroberts Eric Roberts added a comment - Similar scenario as Kevin Rice. I need to upsert a variable amount of values into arrays but pad to a default max in a single call.
          Hide
          mamoulian Neil S added a comment -
          Show
          mamoulian Neil S added a comment - Also related to https://jira.mongodb.org/browse/SERVER-2643 I think
          Hide
          reneseses rene mena added a comment -

          +1

          Show
          reneseses rene mena added a comment - +1
          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

            People

            • Votes:
              143 Vote for this issue
              Watchers:
              94 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since reply:
                2 weeks ago
                Date of 1st Reply: