To update and print to console from MongoDB script, create a variable and then use the print() method.
Let us first create a variable −
> var amount=10.58945;
Here is the query to update % printed to console −
> var amount=10.58945; > print(amount.toFixed(2)+" %");
This will produce the following output −
10.59 %