There is no transaction support in mongo, but you could implement two phase commits as described in http://cookbook.mongodb.org/patterns/perform-two-phase-commits/
Alternatively you could implement some coordination between processes, fx assign data ranges to specific processes if data supports this scenario.
Edit: in very simple form you could implement some optimistic document locking by adding property lockProcessId and use following command sequence:
db.A.findAndModify({_id: someId, lockProcessId:{$exists:false}},{$set:{lockProcessId: someProcessId},{new:true}}
db.A.findAndModify({_id: someId, lockProcessId:someProcessId},{$push:{arr:{ count: count,text:'some text'}},$unset:{lockProcessId:1}})
If first query returns nothing, process should skip this document, otherwise it should run second query
However if some process dies in the middle you could have some documents locked, probably you need some scheduler to clear locked states.