Mapreduce java script to find the avg temperture

In pseudo-JS:

emit([doc.city, doc.date], doc.temp);

Make the reduce function compute an average of the values.

Query with groupLevel=2 to group each unique city/date pair together.