Tutorial for Averaging Over a field MongoDB using MapReduce

Finalize Function

The Mapping Function is below. Add this code to the project right below the GetBookAverage() method:

Map Function

Who is the key and result is the value that is returned although average is what we are looking for both total pages and num are also returned by this method.

Print Function

The print function is already completed in the starter file but I just wanted to include the code in the tutorial.

Map Function