Template
single collection
multiple collections
mgodatagen
update
indexe
explain
Stage
Database
bson
mgodatagen
[{pId:"p1",apikey:"a2",count:0},{pId:"p2",apikey:"a2",count:0},{pId:"p2",apikey:"a3",count:0}]
Query
db.collection.update({$or:[{pId:"p1",apikey:"a2"},{pId:"p2",apikey:"a2"}]},{$inc:{count:1}},{multi:true})
Result