summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-09-13 06:58:00 -0400
committerEliot Horowitz <eliot@10gen.com>2009-09-13 06:58:00 -0400
commit8d07d50c48f76617b1a43d9e96efd47c890f6e8e (patch)
tree914731438ed94e6540f2d8cbcbc5876563b74425
parentd331919eb32148623ed74726c6e7b33607fd7c0c (diff)
downloadmongo-8d07d50c48f76617b1a43d9e96efd47c890f6e8e.tar.gz
fix embedded fields in export SERVER-293
-rw-r--r--tools/export.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/export.cpp b/tools/export.cpp
index 744ee372d70..1e0f3e3f6ad 100644
--- a/tools/export.cpp
+++ b/tools/export.cpp
@@ -74,7 +74,7 @@ public:
pcrecpp::StringPiece input(fields_arg);
string f;
- pcrecpp::RE re("(\\w+),?" );
+ pcrecpp::RE re("([\\w\\.]+),?" );
while ( re.Consume( &input, &f ) ){
fields.push_back( f );
b.append( f.c_str() , 1 );
@@ -107,9 +107,10 @@ public:
for ( vector<string>::iterator i=fields.begin(); i != fields.end(); i++ ){
if ( i != fields.begin() )
out << ",";
- const BSONElement & e = obj[i->c_str()];
- if ( ! e.eoo() )
- out << e.jsonString( TenGen , false );
+ const BSONElement & e = obj.getFieldDotted(i->c_str());
+ if ( ! e.eoo() ){
+ out << e.jsonString( Strict , false );
+ }
}
out << endl;
}