Improved to work with gridfs, allowing to perform large reductions without mongo bson document max size problems