refactoring getAnalysis call now an mongodb aggregation