I have such a collection:
{
"name": "Citroen",
"additionals": [ "tires", "windows", "seats", "belts" ],
"price": [ { "poor": 15.00 }, { "mid": 21.00 }, { "exl": 30.00 } ]
}
and I would like to make a modification of the price of verison
for example mid from 21 to 23, I tried this:
function mod(name, version, newprice){
results = db.Cars.update({"name":name}, {$set: {"price.[0].$":newprice}});
return results;
}
mod("Citroen", "mid", 23)
can you tell me what am I doing wrong?