Design iterator for sorted union | MongoDB Interview Question