Count mongodb queries and store in header