diff options
author | Spencer T Brody <spencer@10gen.com> | 2013-09-20 18:41:21 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2013-09-23 17:18:39 -0400 |
commit | 19140c53ad460ebf741de9c48b224f2443cdb18e (patch) | |
tree | a5017e1b8b2689a051b21ef0e17d267a235462d8 /src/mongo/db/namespace_string.h | |
parent | 69a0994c38b2ff5919325f4bc7af6c9802c6eaac (diff) | |
download | mongo-19140c53ad460ebf741de9c48b224f2443cdb18e.tar.gz |
Introduce NamespaceString::validCollectionName that actually takes a collection name
Diffstat (limited to 'src/mongo/db/namespace_string.h')
-rw-r--r-- | src/mongo/db/namespace_string.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/mongo/db/namespace_string.h b/src/mongo/db/namespace_string.h index 8290a131bd7..afeb698ee21 100644 --- a/src/mongo/db/namespace_string.h +++ b/src/mongo/db/namespace_string.h @@ -130,16 +130,31 @@ namespace mongo { static bool validDBName( const StringData& dbin ); /** + * Takes a fully qualified namespace (ie dbname.collectionName), and returns true if + * the collection name component of the namespace is valid. * samples: * good: * foo.bar * bad: * foo. * - * @param ns - a full namesapce (a.b) + * @param ns - a full namespace (a.b) * @return if db.coll is an allowed collection name */ - static bool validCollectionName(const StringData& ns); + static bool validCollectionComponent(const StringData& ns); + + /** + * Takes a collection name and returns true if it is a valid collection name. + * samples: + * good: + * foo + * system.indexes + * bad: + * $foo + * @param coll - a collection name component of a namespace + * @return if the input is a valid collection name + */ + static bool validCollectionName(const StringData& coll); private: |