tail recursion optimization for mongo driver in DEBUG mode