Rumah > Soal Jawab > teks badan
{
"_id" : ObjectId("570b500b517682cebe1183ee"),
"userName" : "m27",
"colonizeStations" : [
{
"uid" : 1,
"sid" : 703,
"name" : "colonizeship_name",
"state" : 1,
"starId" : 0,
"refineBuildingMap" : [
{
"sid" : 2002,
"x" : -4.7412109375,
"y" : 2.248198986053467,
"z" : 4.6328125,
"lastCollectResourceTime" : 1460367845,
"lastCollectionAdditionTime" : 1460367845,
"resource" : 0
},
{
"sid" : 2052,
"x" : -4.60888671875,
"y" : 4.834808349609375,
"z" : 2.093750476837158,
"lastCollectResourceTime" : 1460367857,
"lastCollectionAdditionTime" : 1460367857,
"resource" : 0
}
]
}
]
}
我想修改 最里面的文档的 “lastCollectionAdditionTime”和”resource”这两个值… 怎么写.
因为不想动到其他的字段.. 我只会修改一层内嵌的数据, 这个是在第二层..
求教大神...
阿神2017-04-17 17:41:11
Ini bukan soal berapa banyak lapisan, tetapi terdapat tatasusunan dalam objek
"$set": {
"colonizeStations.0.refineBuildingMap.<N>.lastCollectionAdditionTime": <NEW VALUE>
}
<N>
menunjukkan elemen mana dalam tatasusunan