summaryrefslogtreecommitdiff
path: root/src/mongo/db/namespace_string.cpp
diff options
context:
space:
mode:
authorJames Wahlin <james.wahlin@10gen.com>2016-08-25 08:36:22 -0400
committerJames Wahlin <james.wahlin@10gen.com>2016-08-26 16:45:30 -0400
commita4a9a9ad29415239091db171e01f45677464f668 (patch)
tree461bbdd6275712543b617ce6e8b8bbc313ffb9e0 /src/mongo/db/namespace_string.cpp
parent752dcf912d5e45c8614ed749e20982e69cc89813 (diff)
downloadmongo-a4a9a9ad29415239091db171e01f45677464f668.tar.gz
SERVER-24771 Support killCursors & mongos getMore on view namespace
Diffstat (limited to 'src/mongo/db/namespace_string.cpp')
-rw-r--r--src/mongo/db/namespace_string.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mongo/db/namespace_string.cpp b/src/mongo/db/namespace_string.cpp
index 43f02e26bb5..1128552ca67 100644
--- a/src/mongo/db/namespace_string.cpp
+++ b/src/mongo/db/namespace_string.cpp
@@ -34,6 +34,8 @@
#include "mongo/db/namespace_string.h"
+#include "mongo/util/mongoutils/str.h"
+
namespace mongo {
using std::string;
@@ -70,6 +72,7 @@ const string escapeTable[256] = {
const char kConfigCollection[] = "admin.system.version";
+constexpr auto listCollectionsCursorCol = "$cmd.listCollections"_sd;
constexpr auto listIndexesCursorNSPrefix = "$cmd.listIndexes."_sd;
} // namespace
@@ -105,7 +108,7 @@ const StringData NamespaceString::kLocalDb = "local"_sd;
const NamespaceString NamespaceString::kConfigCollectionNamespace(kConfigCollection);
bool NamespaceString::isListCollectionsCursorNS() const {
- return coll() == "$cmd.listCollections"_sd;
+ return coll() == listCollectionsCursorCol;
}
bool NamespaceString::isListIndexesCursorNS() const {
@@ -113,6 +116,21 @@ bool NamespaceString::isListIndexesCursorNS() const {
coll().startsWith(listIndexesCursorNSPrefix);
}
+NamespaceString NamespaceString::makeListCollectionsNSS(StringData dbName) {
+ NamespaceString nss(dbName, StringData(str::stream() << listCollectionsCursorCol));
+ dassert(nss.isValid());
+ dassert(nss.isListCollectionsCursorNS());
+ return nss;
+}
+
+NamespaceString NamespaceString::makeListIndexesNSS(StringData dbName, StringData collectionName) {
+ NamespaceString nss(dbName,
+ StringData(str::stream() << listIndexesCursorNSPrefix << collectionName));
+ dassert(nss.isValid());
+ dassert(nss.isListIndexesCursorNS());
+ return nss;
+}
+
NamespaceString NamespaceString::getTargetNSForListIndexes() const {
dassert(isListIndexesCursorNS());
return NamespaceString(db(), coll().substr(listIndexesCursorNSPrefix.size()));