optimized the mongo find method to fetch and count with the same cursor