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

$pushAll several values at once to an array

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 0.9.7
    • Affects Version/s: None
    • Component/s: Usability
    • Labels:
      None

      I have noticed though that $push only accepts a single argument. There could be plenty of scenarios where it would be useful to add multiple values at once to the array. The same would go with a $pull modifier (see http://jira.mongodb.org/browse/SERVER-130).

      For example:

      db.group.insert({_id:1,text:'user group 1',users:[1,2,3]});

      // add some users
      db.group.update({_id:1},{ $pushAll :

      { users : [4,5] }

      } );

      // remove some users
      db.group.update({_id:1},{ $pullAll :

      { users : [1,4] }

      });

            Assignee:
            aaron Aaron Staple
            Reporter:
            wouter Wouter
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: