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

Cannot unset from all items in array

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.2.3
    • Fix Version/s: None
    • Component/s: Write Ops
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      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}})

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: