{
"_id" : ObjectId("522d9783974929f816000000"),
"N" : "3301",
"S" : {
"L" : 373,
"W" : 210,
"H" : 82
},
"M" : "面料:麻料",
"I" : [
"http://l300img.b0.upaiyun.com/lb40_gallary/3301.jpg"
],
"T" : [
{
"N" : "单人位",
"L" : 80,
"W" : 101,
"H" : 82,
"V" : 0.6626,
"P" : 580
},
{
"N" : "单人位",
"L" : 80,
"W" : 101,
"H" : 82,
"V" : 0.6626,
"P" : 580
},
{
"N" : "带扶单位",
"L" : 110,
"W" : 101,
"H" : 82,
"V" : 0.911,
"P" : 730
},
{
"N" : "转角位",
"L" : 101,
"W" : 101,
"H" : 82,
"V" : 0.8365,
"P" : 680
},
{
"N" : "贵妃位",
"L" : 110,
"W" : 101,
"H" : 82,
"V" : 0.911,
"P" : 680
}
],
"O" : false
}
单条数据如上所示,我需要将所有的P:数据值
更改为P:[数据值]
,整个文档所有数据都需要改。
迷茫2017-04-22 08:58:14
db.table_name.find().forEach(function (x){T = x['T'];for (i in T){T[i]['P'] = [T[i]['P'],]};db.table_name.save(x)})