summaryrefslogtreecommitdiff
path: root/src/mongo/db/index_names.cpp
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2014-02-14 14:22:52 -0500
committerHari Khalsa <hkhalsa@10gen.com>2014-02-19 12:45:44 -0500
commitcfdf055eee1b1d0eed3d13c0c2d4d66a27dff662 (patch)
tree08fafe5cf887b3c12e3e07a36a4468db96b8d703 /src/mongo/db/index_names.cpp
parent00c7183b1a79b795f3d39c9079bb2f795c1cabb6 (diff)
downloadmongo-cfdf055eee1b1d0eed3d13c0c2d4d66a27dff662.tar.gz
SERVER-10026 push access method name into index descriptor, pay attention to it in planning
Diffstat (limited to 'src/mongo/db/index_names.cpp')
-rw-r--r--src/mongo/db/index_names.cpp43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/mongo/db/index_names.cpp b/src/mongo/db/index_names.cpp
index 9f0cace9d10..d3f79886e36 100644
--- a/src/mongo/db/index_names.cpp
+++ b/src/mongo/db/index_names.cpp
@@ -37,6 +37,7 @@ namespace mongo {
const string IndexNames::GEO_2DSPHERE = "2dsphere";
const string IndexNames::TEXT = "text";
const string IndexNames::HASHED = "hashed";
+ const string IndexNames::BTREE = "";
// static
string IndexNames::findPluginName(const BSONObj& keyPattern) {
@@ -48,7 +49,47 @@ namespace mongo {
return e.String();
}
- return "";
+ return IndexNames::BTREE;
+ }
+
+ // static
+ bool IndexNames::existedBefore24(const string& name) {
+ return name == IndexNames::BTREE
+ || name == IndexNames::GEO_2D
+ || name == IndexNames::GEO_HAYSTACK
+ || name == IndexNames::HASHED;
+ }
+
+ // static
+ bool IndexNames::isKnownName(const string& name) {
+ return name == IndexNames::GEO_2D
+ || name == IndexNames::GEO_2DSPHERE
+ || name == IndexNames::GEO_HAYSTACK
+ || name == IndexNames::TEXT
+ || name == IndexNames::HASHED
+ || name == IndexNames::BTREE;
+ }
+
+ // static
+ IndexType IndexNames::nameToType(const string& accessMethod) {
+ if (IndexNames::GEO_2D == accessMethod) {
+ return INDEX_2D;
+ }
+ else if (IndexNames::GEO_HAYSTACK == accessMethod) {
+ return INDEX_HAYSTACK;
+ }
+ else if (IndexNames::GEO_2DSPHERE == accessMethod) {
+ return INDEX_2DSPHERE;
+ }
+ else if (IndexNames::TEXT == accessMethod) {
+ return INDEX_TEXT;
+ }
+ else if (IndexNames::HASHED == accessMethod) {
+ return INDEX_HASHED;
+ }
+ else {
+ return INDEX_BTREE;
+ }
}
} // namespace mongo