我该如何在Mongo控制台中取消单个数组元素的属性?例如,我如何从time [1]中取消junk属性?请使用以下命令:db.collection.update({条件},{ $unset: { "time.1.junk": "" } })。
{
"_id" : ObjectId("4d525ab2924f0000000022ad"),
"name" : "hello",
"time" : [
{
"stamp" : "2010-07-01T12:01:03.75+02:00",
"reason" : "new"
},
{
"stamp" : "2010-07-02T16:03:48.187+03:00",
"reason" : "update",
"junk" : "yes"
},
{
"stamp" : "2010-07-02T16:03:48.187+04:00",
"reason" : "update"
},
]
}