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

$pullAll causes empty embedded object field to be created

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.7, 2.2.0-rc0
    • Component/s: Write Ops
    • Labels:
      None
    • Operating System:
      ALL

      Description

      This looks like unusual behavior.

      For example with a document like:

      { "_id" : ObjectId("4fd2736696a0c5567029c674"), "x" : 10 }

      Issuing an update with $pullAll on a key that does not exist inside an embedded doc causes the field to be created:

      db.test.update(

      {x:10}

      , {$pullAll : {"test.a" : ["foo", "bar"]}})

      The (empty) embedded object "test" will now exist in the doc:
      > db.test.find()
      { "_id" : ObjectId("4fd2736696a0c5567029c674"), "test" : { }, "x" : 10 }

      I would have expected no change in the document's fields if the $pullAll references a key that does not exist.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              richard.kreuter Richard Kreuter (Inactive)
              Reporter:
              mpobrien Michael O'Brien
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: