0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-29 00:32:18 +01:00

better fix, allows dump of single collections without prohibited chars

This commit is contained in:
Kevin Matulef 2011-12-08 12:16:09 -05:00
parent c50fed194e
commit 757f86029e

View File

@ -198,25 +198,30 @@ public:
continue;
}
const string filename = name.substr( db.size() + 1 );
//if a particular collections is specified, and it's not this one, skip it
if ( _coll != "" && db + "." + _coll != name && _coll != name )
continue;
// raise error before writing collection with non-permitted filename chars in the name
size_t hasBadChars = name.find_first_of("/\0");
if (hasBadChars != string::npos){
error() << "Cannot dump " << name << ". Collection has '/' or null in the collection name." << endl;
continue;
}
// Don't dump indexes
// Don't dump indexes
if ( endsWith(name.c_str(), ".system.indexes") ) {
continue;
continue;
}
if ( _coll != "" && db + "." + _coll != name && _coll != name )
continue;
continue;
collections.push_back(name);
}
for (vector<string>::iterator it = collections.begin(); it != collections.end(); ++it) {
string name = *it;
const string filename = name.substr( db.size() + 1 );