I have the following data:
{
"name": "tom",
"songs": [
{ "songname": "hello", "day": "20" },
{ "songname": "goodbye", "day": "25" },
{ "songname": "morning", "day": "15" }],
"solo": "yes"
}
I want to increment the day of each of the songs in the array by 2 for the person with the name tom. I figured using $inc such as
db.collection.update({ "name": "tom" }, { "$inc": { "songs.day": 2 } })
would work but it doesnt work. I get the error "errmsg" : "The positional operator did not find the match needed from the query."