How to update % printed 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: 31-Mar-2020

85 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements