Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1081

$pull operator doesn't work with dot notation

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 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

      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@mongodb.com Matt Broadstone
            Reporter:
            natanavra Natan A
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: