I have this collection
> db.styles.find({"_id":"EP65"}).pretty();
{
"__v" : 6,
"_id" : "EP65",
"colours" : {
"GRYM" : [
{
"on_sale" : false,
"size_code_id" : "XS",
"sku" : "EP65-GRYM0"
},
{
"on_sale" : false,
"size_code_id" : "2XL",
"sku" : "EP65-GRYM5"
}
],
"BLUT" : [
{
"on_sale" : false,
"size_code_id" : "XS",
"sku" : "EP65-BLUT0"
},
{
"on_sale" : false,
"size_code_id" : "X",
"sku" : "EP65-BLUT1"
}
]
}
}
I would like to rename the "on_sale" to "visible", I have about 200 styles each of which has one or many colours.
So basically I want to loop through all the styles collection and for each colour.key rename the "on_sale" to "visible"
any advice is much appreciated