summaryrefslogtreecommitdiff
path: root/src/mongo/db/namespace_string-inl.h
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@10gen.com>2013-09-20 18:41:21 -0400
committerSpencer T Brody <spencer@10gen.com>2013-09-23 17:18:39 -0400
commit19140c53ad460ebf741de9c48b224f2443cdb18e (patch)
treea5017e1b8b2689a051b21ef0e17d267a235462d8 /src/mongo/db/namespace_string-inl.h
parent69a0994c38b2ff5919325f4bc7af6c9802c6eaac (diff)
downloadmongo-19140c53ad460ebf741de9c48b224f2443cdb18e.tar.gz
Introduce NamespaceString::validCollectionName that actually takes a collection name
Diffstat (limited to 'src/mongo/db/namespace_string-inl.h')
-rw-r--r--src/mongo/db/namespace_string-inl.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mongo/db/namespace_string-inl.h b/src/mongo/db/namespace_string-inl.h
index ec6d6c7225c..74b8d0a3eb6 100644
--- a/src/mongo/db/namespace_string-inl.h
+++ b/src/mongo/db/namespace_string-inl.h
@@ -87,15 +87,20 @@ namespace mongo {
return true;
}
- inline bool NamespaceString::validCollectionName(const StringData& ns){
+ inline bool NamespaceString::validCollectionComponent(const StringData& ns){
size_t idx = ns.find( '.' );
if ( idx == std::string::npos )
return false;
- if ( idx + 1 >= ns.size() )
+ return validCollectionName(ns.substr(idx + 1)) || oplog(ns);
+ }
+
+ inline bool NamespaceString::validCollectionName(const StringData& coll){
+ if (coll.empty())
return false;
- return normal( ns );
+ return coll.find('$') == std::string::npos;
+
}
inline NamespaceString::NamespaceString() : _ns(), _dotIndex(0) {}