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

Cannot unset from all items in array

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.3
    • Component/s: Write Ops
    • Labels:
      None
    • ALL
    • Hide

      See example doc in description then run:
      db.example.update({_id: ObjectId("52c5e5d2bd546795dee87ca4")}, {$unset: {"c.pi": 1}})

      Show
      See example doc in description then run: db.example.update({_id: ObjectId("52c5e5d2bd546795dee87ca4")}, {$unset: {"c.pi": 1}})

      Running an "unset" on a key inside of array objects says it updated documents but it didn't.

      Example doc:

      {
              "_id" : ObjectId("52c5e5d2bd546795dee87ca4"),
              "c" : [
                      {"pi" : NumberLong(2368999)},
                      {"pi" : NumberLong(2368999)},
                      {"pi" : NumberLong(2368999)}
              ]
      }
      

      Example query:

      db.example.update({_id: ObjectId("52c5e5d2bd546795dee87ca4")}, {$unset: {"c.pi": 1}})

      When I run that query using the PHP driver it returns:
      "updatedExisting"= > true
      "n" => 1

      However nothing was actually unset. I know there's another bug filed (SERVER-1243) for a feature request to use a position operator on multiple items, but this should have affected ALL items in the collection, I'm not using $elemMatch or anything else. Is that not supported?

      I said affects versions 2.2.3 because that's all we have running at Grooveshark but it might affect newer versions.

            Assignee:
            Unassigned Unassigned
            Reporter:
            fastest963 James Hartig
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: