We\'re using MongoDB and I\'m figuring out a schema for storing Ratings.
from
The Below code can be used to get the average rating for each users.
db.ratings.aggregate([ { $match:{ rated: '$user' }, }, { $order: { _id: "$rated", average: { $avg: "$rating" } } ])