summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Diamond <brandon@10gen.com>2011-11-29 17:33:07 -0500
committerBrandon Diamond <brandon@10gen.com>2012-02-15 16:48:45 -0500
commit29cd169c4dccacb86d33bc9e30833ea1ae422d3e (patch)
treee46f65219a0014b9940772059d5e8573e4986d05
parentf96f1c70ec5154a07c1171b421953961ea480737 (diff)
downloadmongo-29cd169c4dccacb86d33bc9e30833ea1ae422d3e.tar.gz
SERVER-3112: Improved stdout/err in mongoexport
-rw-r--r--tools/export.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/export.cpp b/tools/export.cpp
index c3a5420438d..0d9f0225da0 100644
--- a/tools/export.cpp
+++ b/tools/export.cpp
@@ -45,6 +45,19 @@ public:
_usesstdout = false;
}
+ virtual void preSetup() {
+ string out = getParam("out");
+ if ( out == "-" ) {
+ // write output to standard error to avoid mangling output
+ // must happen early to avoid sending junk to stdout
+ useStandardOutput(false);
+ }
+ }
+
+ virtual void printExtraHelp( ostream & out ) {
+ out << "Export MongoDB data to CSV, TSV or JSON files.\n" << endl;
+ }
+
// Turn every double quote character into two double quote characters
// If hasSurroundingQuotes is true, doesn't escape the first and last
// characters of the string, if it's false, add a double quote character