MongoDB interview question

Code review and provide better mode