3

I am working with MongoDB in a Node server.

While my program is running i get a lot of output in the shell, like querys and other information. If i am right that is a lot of work more for the process, so i want to hide all kind of output.

I try runing the comand with the parameter --quiet

mongod --quiet

So i assume that i miss a configuration in the mongo driver of node.

Technicals:

  • MongoDB Version: 3.2.9
  • Node Version:v6.4.0
MatCas
  • 773
  • 8
  • 19
  • 2
    `--quiet` is to be _less chatty_. To remove everything, what if you say `mongo &>/dev/null`? All the output will go to `/dev/null` and hence not showed. – fedorqui Aug 26 '16 at 08:04
  • @fedorqui amazing, thanks you man, now, can you explain me a little more what its happend? – MatCas Aug 26 '16 at 13:38
  • 1
    Glad that it worked. I added an answer to have space enough to explain it :) – fedorqui Aug 26 '16 at 13:44

1 Answers1

6

mongod documentation states:

--quiet

Runs the mongod in a quiet mode that attempts to limit the amount of output.

This option suppresses:

  • output from database commands
  • replication activity
  • connection accepted events connection closed events

So still some output emerges from the process. To prevent this and hide ALL the output, both stdout and stderr, you need to say either of these equivalent commands:

process &>/dev/null
process >/dev/null 2>&1

In your case:

mongod &>/dev/null
mongod >/dev/null 2>&1

See What is /dev/null 2>&1? for some explanations on how this works.

Community
  • 1
  • 1
fedorqui
  • 275,237
  • 103
  • 548
  • 598