我正在研究一个简单的考勤系统,该系统应该具有这样的结构
{
"_id" : ObjectId("5a800c280856ed210f6553cb"),
"class" : 1,
"subject" : {
"maths" : {
"grammer" : "0",
"spelling" : "0",
"marks" : 25
},
"science" : {
"grammer" : "1",
"spelling" : "1",
"marks" : 21
},
"history" : {
"grammer" : "1",
"spelling" : "1",
"marks" : 28
}
},
"name" : "max",
"roll no" : 10
}
我想要做的是创建另一个出勤领域,如下所示
{
"_id" : ObjectId("5a800c280856ed210f6553cb"),
"class" : 1,
"subject" : {
"maths" : {
"grammer" : "0",
"spelling" : "0",
"marks" : 25
},
"science" : {
"grammer" : "1",
"spelling" : "1",
"marks" : 21
},
"history" : {
"grammer" : "1",
"spelling" : "1",
"marks" : 28
}
},
"name" : "max",
"roll no" : 10
"attendace":{"Tue Feb 11 2018 12:14:36 GMT+0530 (IST)": 1,
"Tue Feb 12 2018 12:14:36 GMT+0530 (IST)": 1,
"Tue Feb 13 2018 12:14:36 GMT+0530 (IST)": 1
}
}
我尝试了以下命令,但它无法正常工作
db.candidates.update({"_id" : ObjectId("5a800c280856ed210f6553cb") },{$set : {"attendance":{Date():1}}})
非常感谢任何帮助
关心赛义夫