MongoDB interview question

API design question with some standard library usage required.