From 7cf75927e2bcd77906b02eab5ed2c8edbc0aa6f2 Mon Sep 17 00:00:00 2001 From: Spencer T Brody Date: Tue, 26 Jul 2011 11:42:51 -0400 Subject: [PATCH] Fix test failures resulting from trying to query DB in tools that don't use a specific collection (dump/restore). --- tools/tool.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/tool.cpp b/tools/tool.cpp index 22228e66999..d938e752041 100644 --- a/tools/tool.cpp +++ b/tools/tool.cpp @@ -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; }