Update Printed Output to Console from MongoDB



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 %
Updated on: 2020-03-31T08:24:16+05:30

99 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements