I have a nested array structured like this
{
"_id": "5dff75968102f11e20ae888e",
"docID": "Employees",
"data": [
[
"234768237",
"Value1",
],
[
"234768238",
"Value2"
],
[
"234768239",
"Value3"
]
]
}
Inside the nested data array, first element is employee ID, Ex: 234768237. I would want to pass an array of employee ID's and delete the matching ones, for ex : [234768237, 234768238]
What i have tried so far
let employeeIDArray = [234768237, 234768238];
collection.updateOne(
{ docID: "Employees" },
{
$pull: {
"data.$[]": { "0": { $each: employeeIDArray } }
}
}
);