Actually there is no way to avoid it, because there is no such command that can increment all the values inside the subdocument.
So the only way to do it is to do something like you have done:
{
"$inc": {
"groceries.apples" : 1,
"groceries.cherries" : 1,
"groceries.prunes" : 1
}
}
Because you do not know what are the fields exactly, you need to find them beforehand and to create the $inc statement. There is one good thing about these updates: no matter how may elements do you have, you will still need only 2 queries (find what to update and to actually perform update).
I was also thinking how to achieve a better results with a different schema, but apparently you have to cope with what you have.