{
"_id" : ObjectId("522d9783974929f816000000"),
"N" : "3301",
"S" : {
"L" : 373,
"W" : 210,
"H" : 82
},
"M": "Fabric: hemp",
"I" : [
"http://l300img.b0.upaiyun.com/lb40_gallary/3301.jpg"
],
"T" : [
{
"n": "single person",
"L" : 80,
"W" : 101,
"H" : 82,
"V" : 0.6626,
"P" : 580
},
{
"n": "single person",
"L" : 80,
"W" : 101,
"H" : 82,
"V" : 0.6626,
"P" : 580
},
{
"n": "with supporting units",
"L" : 110,
"W" : 101,
"H" : 82,
"V" : 0.911,
"P" : 730
},
{
"n": "corner position",
"L" : 101,
"W" : 101,
"H" : 82,
"V" : 0.8365,
"P" : 680
},
{
"n": "imperial concubine position",
"L" : 110,
"W" : 101,
"H" : 82,
"V" : 0.911,
"P" : 680
}
],
"O" : false
}
A single data as shown above, I need to put all theP: data value
Change toP:[ data value]
, all data of the whole document need to be changed.
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)})