$pushAll several values at once to an array

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Minor - P4
    • 0.9.7
    • Affects Version/s: None
    • Component/s: Usability
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • 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 Staple (Inactive)
            Reporter:
            Wouter
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: