summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBrandon Diamond <brandon@10gen.com>2011-10-06 11:25:13 -0400
committerBrandon Diamond <brandon@10gen.com>2011-10-06 11:25:13 -0400
commit3db92ac2093712967fa73da5a23ba8fd8a2e11d9 (patch)
treea045e53c933ff17715d2dba4df47e5b0123f471f /tools
parent0ad766835b0dc6f21643501fd38bc4cabd306878 (diff)
downloadmongo-3db92ac2093712967fa73da5a23ba8fd8a2e11d9.tar.gz
SERVER-3690: Header excluded from CSV import objcount
Diffstat (limited to 'tools')
-rw-r--r--tools/import.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/import.cpp b/tools/import.cpp
index d10b9a137f1..b5148bb86be 100644
--- a/tools/import.cpp
+++ b/tools/import.cpp
@@ -274,6 +274,7 @@ public:
int run() {
string filename = getParam( "file" );
long long fileSize = 0;
+ int headerRows = 0;
istream * in = &cin;
@@ -352,8 +353,12 @@ public:
if ( _type == CSV || _type == TSV ) {
_headerLine = hasParam( "headerline" );
- if ( ! _headerLine )
+ if ( _headerLine ) {
+ headerRows = 1;
+ }
+ else {
needFields();
+ }
}
if (_type == JSON && hasParam("jsonArray")) {
@@ -434,7 +439,7 @@ public:
}
}
- cout << "imported " << num << " objects" << endl;
+ cout << "imported " << ( num - headerRows ) << " objects" << endl;
conn().getLastError();