How can i calculate the average of an attribute which is in an Array in a MongoDB Document?

I have the Collection Movies and some Customer can add Stars to the Movie which you can see in the link.

My Question is how can i calculate the average Stars of every Movie and can print the average Stars in a sorted order on the console?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum