$pull operator doesn't work with dot notation

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.2.2
    • Component/s: MongoDB 3.4
    • Environment:
      Mac OS X 10.12
      Mongo 3.4
      Node 6.9.2
      Node Driver 2.2.16
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Example document:

      {
        _id: ObjectId("123"),
        array: [
          {
             _id: ObjectId("456")
          }
         ]
      }
      

      The following query doesn't work:

      let find = {_id: new ObjectID("123")};
      let update = {$pull: {'array._id': new ObjectID("456")}};
      collection.updateMany(find, update);
      

      The output is: cannot use the part (array of array._id) to traverse the element

      If we change the update query to:
      let update = {$pull: {array: {_id: new ObjectID("456")};}}
      Everything works as expected.

              Assignee:
              Matt Broadstone
              Reporter:
              Natan A
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: