simple refactor for mongo db