This also isn’t the most efficient approach for high performance because db.eval() monopolizes mongod, so depending on the database usage pattern this could be pretty disruptive. On the other hand, this mongod behavior effectively acts as a lock and means calling this function will be atomic.
If we are to believe the above comment, it just means that executing a server side MongoDB function is blocking and that doesn’t really sound scalable at all. Not to mention that I thought they improved on this behavior with the MongoDB 1.4 release.
I’m wondering if anyone can clarify what is the behavior for server-side MongoDB functions.