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

Not possible to use multiple $push statements in the same update() command

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.8.4, 2.0.1
    • Component/s: Write Ops
    • Labels:
      None
    • Environment:
      all
    • ALL

      If an update() command contains multiple $push statements, only the last one will be executed.

      To reproduce:

      > db.test.drop()
      true
      > db.test.save({_id:1, "array1":[0], "array2":["a"]})
      > db.test.find()

      { "_id" : 1, "array1" : [ 0 ], "array2" : [ "a" ] }

      > db.test.update({_id:1}, {$push:

      {"array1":1}

      , $push:{"array2":"b"}})
      > db.test.find()

      { "_id" : 1, "array1" : [ 0 ], "array2" : [ "a", "b" ] }

            Assignee:
            Unassigned Unassigned
            Reporter:
            mbastien Marc Bastien
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: