refactor mongo cursor