analysis code to parse mongodb