summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands.cpp')
-rw-r--r--src/mongo/db/commands.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp
index 42bad714800..8bb1892afe5 100644
--- a/src/mongo/db/commands.cpp
+++ b/src/mongo/db/commands.cpp
@@ -106,13 +106,13 @@ string Command::parseNs(const string& dbname, const BSONObj& cmdObj) const {
if (first.type() != mongo::String)
return dbname;
- return str::stream() << dbname << '.' << cmdObj.firstElement().valuestr();
+ return str::stream() << dbname << '.' << cmdObj.firstElement().valueStringData();
}
ResourcePattern Command::parseResourcePattern(const std::string& dbname,
const BSONObj& cmdObj) const {
- std::string ns = parseNs(dbname, cmdObj);
- if (ns.find('.') == std::string::npos) {
+ const std::string ns = parseNs(dbname, cmdObj);
+ if (!NamespaceString::validCollectionComponent(ns)) {
return ResourcePattern::forDatabaseName(ns);
}
return ResourcePattern::forExactNamespace(NamespaceString(ns));