Refactoring mongo access in marks and Teacheradmin stats views