summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-01-17 15:31:43 -0500
committerEliot Horowitz <eliot@10gen.com>2011-01-17 15:32:40 -0500
commit880a77542336fedbc0efa5cb69227425398fb26f (patch)
treeafa2c08cbed583fd8f427e989fe1dcd096a94c24 /tools
parent00d67d07a9cde9d5736909b5357bf829bd1c1663 (diff)
downloadmongo-880a77542336fedbc0efa5cb69227425398fb26f.tar.gz
fix projecton generation for export since it uses getFieldDotted SERVER-2369
Diffstat (limited to 'tools')
-rw-r--r--tools/export.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/tools/export.cpp b/tools/export.cpp
index b1b0f5f1ac9..0262c4bf174 100644
--- a/tools/export.cpp
+++ b/tools/export.cpp
@@ -82,10 +82,25 @@ public:
if ( hasParam( "fields" ) || csv ) {
needFields();
- fieldsToReturn = &_fieldsObj;
+
+ // we can't use just _fieldsObj since we support everything getFieldDotted does
+
+ set<string> seen;
+ BSONObjBuilder b;
+
+ BSONObjIterator i( _fieldsObj );
+ while ( i.more() ){
+ BSONElement e = i.next();
+ string f = str::before( e.fieldName() , '.' );
+ if ( seen.insert( f ).second )
+ b.append( f , 1 );
+ }
+
+ realFieldsToReturn = b.obj();
+ fieldsToReturn = &realFieldsToReturn;
}
-
-
+
+
if ( csv && _fields.size() == 0 ) {
cerr << "csv mode requires a field list" << endl;
return -1;