Pull Document By ID from Triple Nested Array MongoDB Pull Document By ID from Triple Nested Array MongoDB mongoose mongoose

Pull Document By ID from Triple Nested Array MongoDB


The last attempt is correct however you need to fix two things: fruit instead of fruit (according to your sample data) and types needs to match so you have to convert string to ObjectId

db.stuff.update({}, {$pull: {"fruit.$[].kinds.$[].details' : {_id: mongoose.Types.ObjectId("123123123")}}})