mongodb pull from array without using $in

Viewed 22

I seem to be able to pull elements from an array of objects by an object's field without using $in and I'm not sure why. I've written two tests that prove it works but it seems crazy to me. Is this valid?

Suppose the model { items: [ { name: '1', id: 1 }, { name: '2', id: 2 } ] }

I am incredibly surprised this works without $in: [1,2]

model.updateOne({_id}, { $pull: { items: {id: [1,2] } } })

Am I getting false positives on my tests? I see the array change, etc..

0 Answers
Related