'Ensure that a field mapped to a db field with a different name
can have its average computed correctly.'

def test_average_over_db_field(self):

    class UserVisit(Document, ):
        num_visits = IntField(db_field='visits')
    UserVisit.drop_collection()
    UserVisit.objects.create(num_visits=20)
    UserVisit.objects.create(num_visits=10)
    self.assertEqual(UserVisit.objects.average('num_visits'), 15)
