summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands_admin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/commands_admin.cpp')
-rw-r--r--src/mongo/s/commands_admin.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/s/commands_admin.cpp b/src/mongo/s/commands_admin.cpp
index 761398c2bea..08ae02bf813 100644
--- a/src/mongo/s/commands_admin.cpp
+++ b/src/mongo/s/commands_admin.cpp
@@ -532,8 +532,15 @@ namespace mongo {
ScopedDbConnection conn(config->getPrimary().getConnString());
//check that collection is not capped
- BSONObj res = conn->findOne( config->getName() + ".system.namespaces",
- BSON( "name" << ns ) );
+ BSONObj res;
+ {
+ std::list<BSONObj> all = conn->getCollectionInfos( config->getName(),
+ BSON( "name" << nsToCollectionSubstring( ns ) ) );
+ if ( !all.empty() ) {
+ res = all.front().getOwned();
+ }
+ }
+
if ( res["options"].type() == Object &&
res["options"].embeddedObject()["capped"].trueValue() ) {
errmsg = "can't shard capped collection";