Fix test failures resulting from trying to query DB in tools that don't use a

specific collection (dump/restore).
This commit is contained in:
Spencer T Brody
2011-07-26 11:42:51 -04:00
parent 8e6949567a
commit 7cf75927e2

View File

@@ -383,7 +383,10 @@ namespace mongo {
if ( ! ( _username.size() || _password.size() ) ) {
// Make sure that we don't need authentication to connect to this db
// findOne throws an AssertionException if it's not authenticated.
conn().findOne(getNS(), Query("{}"));
if (_coll.size() > 0) {
// BSONTools don't have a collection
conn().findOne(getNS(), Query("{}"));
}
return;
}