upserting an array with $inc in MongoDB

I want to create a query that will increment a counter in an object inside an array, but in case the object does not exist - it will be created (upsering)

example:

{
'_id' : 'someId',
someArray : [..,{'name':'a', 'count':234},..],
...
}

how will an upsert of the object {'name' : 'b'} will look like?

I'm using Node.js for the server side if that matter.

thanks @freakish.

I did changed my structure - but still stayed with one collection. instead of an array I used an object:

someObject : {'a':234, 'b':1}...

I did it this way because I understand there is a problem to upsert an array element with the $inc property: How to increment object fields inside an array using MongoDB?

this solution works for me since I do not expect more than 100 elements in this object