MongoDB interview question

Time complexity questions and analysis of code