Lost in MongoDB: Learning to Aggregate

I am getting to the end of stage one in writing a database driver for MongoDB to use in my Lockdown Project sudsjs.com. All has gone well until I get to totalling up a field in the database. I had to enter the wonderful world of aggregation, which is confusing, powerful and function-rich.