How do I delete data at a specific location in an array in the Models of Mongoose?

problem description

how do I delete data at a specific location in an array in mongodb?
the entity of an aircraft like this:

number:B-xxxx,
components:[fuselage,wings,engines,landinggears]

I now want to delete the third data in components, but I can"t find a way to delete it by index.

the environmental background of the problems and what methods you have tried

if you want to delete data from an array in an instance, you usually use the $pop or $pull method.
but $pop can only delete the first or last bit of data, and the $pull method must specify the name of the data to be deleted

related codes

var jobcardSchema = new mongoose.Schema ({

)
AIRPLANENUMBER:{type:String,unique:false,requied:true},
MAINTAINNUMBER:{type:String,unique:false},
MAINTAINDATE:{type:Date},
MISSION:{type:Array}

}, {versionKey:"_somethingElse"});

var jobcard = mongoose.model ("dbjobcard",jobcardSchema,"JOBCARD");

jobcard.findOneAndUpdate ({AIRPLANENUMBER: "xxxx", MAINTAINNUMBER:"xxx"}, {$pop: {MISSION:-1}}, function (err,result) {});
/ / this method can only delete the first bit of data

call for help, MAYDAY

Apr.02,2021

the corresponding mongo shell script is written as follows:
db.jobcard.update ({AIRPLANENUMBER: "xxxx", MAINTAINNUMBER:'xxx'}, {$pullAll: {MISSION: ['fuselage']}})

reference documentation: $pullAll

Menu