The primary responsibility of the stats helper module is to gather some totals for our application. These stats are for things such as the total number of images uploaded, the total number of comments, the total views for all the images combined, and the total likes for all the images combined. Your first inclination might be to assume that we are going to query MongoDB for all the images and loop through every image to track all of the views and totals. That's one way to do it, but it's pretty inefficient. Fortunately, MongoDB has some built-in functionalities which make generating these kinds of values a snap.
As we are going to be making a number of calls to MongoDB, we are going to rely on the async.parallel function ...