The --quiet flag suppresses some informational messages, such as those thrown from tool.cpp:
"connected to: 127.0.0.1"
"file out.bson empty, skipping"
Some tools seem to also throw informational messages using the log() function. These messages are not suppressed by the --quiet flag. In some cases, these messages are going to stdout when data is also being written to that stream, and could corrupt the data.
mongodump --> with --quiet, this message goes to stdout:
"2013-10-01T11:05:29.223-0400 DATABASE: digg to dump/digg"
https://github.com/mongodb/mongo/blob/master/src/mongo/tools/dump.cpp#L193
mongorestore --> with --quiet, these messages go to stdout:
2013-10-01T11:23:53.629-0400 out.bson
2013-10-01T11:23:53.629-0400 going into namespace [digg.out]
2013-10-01T11:23:53.629-0400 out.metadata.json not found. Skipping.
mongoimport --> with --quiet, these messages go to stdout
2013-10-01T11:47:36.204-0400 check 0 0
2013-10-01T11:47:36.205-0400 imported 0 objects
Also related is a problem with mongofiles. Mongofiles seems to output some informational messages using cout.
mongofiles --> with --quiet, these messages go to stdout
added file:
done!
- is related to
-
SERVER-10886 tools with direct db access can produce corrupted output when dumping to stdout in "offline" mode (with --dbpath)
- Closed
- related to
-
SERVER-10885 mongodump produces invalid bson when dumping to stdout in verbose mode
- Closed