Let\'s assume the following schema:
{
\'_id\' : \'star_wars\',
\'count\' : 1234,
\'spellings\' : [
{ spelling: \'Star wars\', total: 10},
{ spell
You could change your schema a little, though. If your documents looked like this:
{
'_id' : 'star_wars',
'count' : 1234,
'spellings' :
{
'Star wars': 10,
'Star Wars': 15,
'sTaR WaRs': 5
}
}
Your updates would become as simple as:
db.movies.update({_id:"star_wars"},{$inc:{"spellings.Star Wars":1}},true)