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

$pull operation does not work with $each

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.1
    • Component/s: Internal Code
    • None
    • ALL
    • Hide

      Copy-paste from console:

      > db.test.save({_id : 1})
      > db.test.find()

      { "_id" : 1 }

      > db.test.update({_id : 1}, {$addToSet: {flags : {$each : [1,2,3,4,5,6]}}})
      > db.test.find()

      { "_id" : 1, "flags" : [ 1, 2, 3, 4, 5, 6 ] }

      > db.test.update({_id : 1}, {$pull: {flags : {$each : [1,2,3]}}})
      > db.test.find()

      { "_id" : 1, "flags" : [ 1, 2, 3, 4, 5, 6 ] }
      Show
      Copy-paste from console: > db.test.save({_id : 1}) > db.test.find() { "_id" : 1 } > db.test.update({_id : 1}, {$addToSet: {flags : {$each : [1,2,3,4,5,6] }}}) > db.test.find() { "_id" : 1, "flags" : [ 1, 2, 3, 4, 5, 6 ] } > db.test.update({_id : 1}, {$pull: {flags : {$each : [1,2,3] }}}) > db.test.find() { "_id" : 1, "flags" : [ 1, 2, 3, 4, 5, 6 ] }

      $addToSet with $each works OK, but $pull does not

            Assignee:
            Unassigned Unassigned
            Reporter:
            anatoly Anatoly Borisov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: