This is my data I want to remove this specific object only:
thanks to advance how to remove the specific object from a nested array element
{ "_id" : ObjectId("5397eb925d2664177b0fc5a6"), "answer" : "Item Question 1 - Answer 1", "isCorrectAnswer" : true }
Input data:
{
"_id" : ObjectId("5397e4b75c4c9bf0509709ab"),
"name" : "Item Name",
"description" : "Item Description",
"questions" : [
{
"_id" : ObjectId("5397eb925d2664177b0fc5a5"),
"question" : "Item Question 1",
"answers" : [
{
"_id" : ObjectId("5397eb925d2664177b0fc5a6"),
"answer" : "Item Question 1 - Answer 1",
"isCorrectAnswer" : true
},
{
"_id" : ObjectId("5397eb925d2664177b0fc5a7"),
"answer" : "Item Question 1 - Answer 2",
"isCorrectAnswer" : false
}
]
},
{
"_id" : ObjectId("5397eb925d2664177b0fc5a9"),
"question" : "Item Question 2",
"answers" : [
{
"_id" : ObjectId("5397eb925d2664177b0fc5aa"),
"answer" : "Item Question 2 - Answer 1",
"isCorrectAnswer" : false
},
{
"_id" : ObjectId("5397eb925d2664177b0fc5ab")
"answer" : "Item Question 2 - Answer 2",
"isCorrectAnswer" : true
}
]
}
]
}
expected output:
{
"_id" : ObjectId("5397e4b75c4c9bf0509709ab"),
"name" : "Item Name",
"description" : "Item Description",
"questions" : [
{
"_id" : ObjectId("5397eb925d2664177b0fc5a5"),
"question" : "Item Question 1",
"answers" : [
{
"_id" : ObjectId("5397eb925d2664177b0fc5a7"),
"answer" : "Item Question 1 - Answer 2",
"isCorrectAnswer" : false
}
]
},
{
"_id" : ObjectId("5397eb925d2664177b0fc5a9"),
"question" : "Item Question 2",
"answers" : [
{
"_id" : ObjectId("5397eb925d2664177b0fc5aa"),
"answer" : "Item Question 2 - Answer 1",
"isCorrectAnswer" : false
},
{
"_id" : ObjectId("5397eb925d2664177b0fc5ab")
"answer" : "Item Question 2 - Answer 2",
"isCorrectAnswer" : true
}
]
}
]
}
thanks to advance how to remove the specific object from a nested array element