I am working on an app that contain details of an academic year in Multilevel structure of mongoDB database.
For this I've created structure like this:
[
{
"_id" : ObjectId("5a1519a71fe8cc4df5888ff5"),
"academicyear" : "2016-2017",
"departments" : [
{
"deptname" : "computer",
"semesters" : [
{
"sem" : "2",
"classes" : [
{
"class" : "1",
"theory" : [
{
"subname" : "DS",
"faculty" : [
{
"facultyname" : "KSS",
"facultydept" : "COMP"
}
]
}
],
"practical" : [
{
"subname" : "DS",
"batch" : [
{
"bname" : "C",
"facultyname" : "KSS",
"facultydept" : "COMP"
}
]
}
]
}
]
}
]
}
]
}
]
Now for the same academic year and for the same department I would like to create a new semester node inside the array of semesters. For that I've tried syntax of $ and use of . operator but it did not worked well. How can I add a new semester node inside that semesters array? Also after creating a new semester node, how can I add a new class in an classes array?