Partial mongo db refactor