mongodb increment counter on select
Is there any way to update the documents by incrementing ($incr) their counter field (lets say there is a counter field) by 1 when the documents are returned by a find command ?
there are no ways but to update this manually?
Unfortunately there is no support for internal triggering or anything similar in MongoDB. You'll have to do that manually.
Here is the discussion about the triggers feature.
Have you looked at using findAndModify? You can find the doc, atomically update it, and then return it in one operation.