Making the necessary MongoDB query changes