MongoDB interview question

How to square integers in array and keep it sorted