Avoid printing output in mongo client

I work with a mongo client. Sometimes the output of some of the commands that I execute includes a huge output, which mongo prints on the screen. How can i avoid this?

+6
source share
2 answers

There is a way to suppress output. Using "var x = ...; " allows you to hide the output of expressions. But there are other teams that are difficult to suppress, for example,

 Array.prototype.distinct = function() { return []; } 

This creates a print of a new specific function. To suppress it , you will need to write it as follows:

 var suppressOutput = ( Array.prototype.distinct = function() { return []; } ); 
+7
source

In a comment from @WiredPrairie, this solution worked for me:

Just set the return value to a local variable: var x=db.so.find(); and check it as necessary.

0
source

Source: https://habr.com/ru/post/944466/


All Articles