Professional Documents
Culture Documents
Mongo Command
Mongo Command
insert({
subject: 'Mathematics'//changes to a variable
date:'2/3/2020'// selected date variable
class: 'JSS1A' // class variable
term: ''
session: ''
Present: [id]// array of ids
absent: [id]
-----------------
attend:[
{//embedded objects having arrays as embedded
class: 1,
date: '',
Present: '',
Absent:''
},
{
class :2, //increment class 1
date: '',
Present: '',
Absent:''
},
{
class: 3,// increment class 2
date: '',
Present: '',
Absent:'',
}
]
});
// can i do in a way it updatesthisparticular subject instead of always creating
new one
}
}
})
Use upsert to merge update and insert command where subject=, class=, term=,
session=.so it will insert if not found butupdate if it is found