I want to delete an array from a 2d array from my mongoDB collection. My Schema looks like:
{
"_id" : ObjectId("6218e63e4f9e4efbb05de2bf"),
"name" : "Toyota",
"rate" : 50,
"fine" : 5,
"datesBooked" : [
[
"2022-02-08",
"2022-02-14"
],
[
"2022-02-16",
"2022-02-18"
],
[
"2022-02-20",
"2022-02-22"
],
[
"2022-02-24",
"2022-02-25"
],
[
"2022-03-01",
"2022-03-02"
],
[
"2022-03-01",
"2022-03-02"
]
],
"__v" : 0
}
I would like to find an object with a certain _id and delete a particular element from the datesBooked 2d array. I tried using $pull function but I couldn't get it right. Can someone please tell me how should I be doing this! I'm using express and javascript to do this. Also, I am noob. Already grateful thanks!