** I have this collection which I want to update without affectin any previous data **
{
"semester": "4",
"subjectData": {
"subjectName": "english",
"questionBank": {
"question": "who are you?",
"answer": {
"introduction": "Hello my name is BHoola",
"features": [
"tall",
"handsome"
],
"kinds": [
"very",
"kind"
],
"conclusion": "Mighty man",
}
}
}
}
** Currently I am trying to do this with** const insertResult = await semesterData.updateMany( { $and: [ { semester: semesterRecieved, 'subjectData.subjectName': subject, }, ], }, { $set: { 'subjectData.questionBank.question': questionRecieved, 'subjectData.questionBank.answer': answerRecieved, }, }, { upsert: false }, );
** to which I am getting acknowledge: false **
** I want my collection to look like this **
"semester": "4",
"subjectData": {
"subjectName": "english",
"questionBank": {
"question": "why are you so tall?",
"answer": {
"introduction": "Hello my name is 3333",
"features": [
"tall",
"handsome"
],
"kinds": [
"very",
"kind"
],
"conclusion": "Mighty man",
},
},
{
"question": "who are you?",
"answer": {
"introduction": "Hello my name is 33333",
"features": [
"tall",
"handsome"
],
"kinds": [
"very",
"kind"
],
"conclusion": "Mighty man",
},
}
}
}```