summaryrefslogtreecommitdiff
path: root/src/mongo/db/index_names.cpp
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-05-01 10:01:08 -0400
committerHari Khalsa <hkhalsa@10gen.com>2013-05-02 15:58:09 -0400
commitc81781d4064998e1cd5d98f6e89c9359f2b7e323 (patch)
treef78ae5ebe5bbb660e383964ae17c6f523c298ebf /src/mongo/db/index_names.cpp
parent41a2d01e419cabd2011ce4ce7262eb8b7181d9e7 (diff)
downloadmongo-c81781d4064998e1cd5d98f6e89c9359f2b7e323.tar.gz
SERVER-8791 SERVER-9212 remove IndexSpec
Diffstat (limited to 'src/mongo/db/index_names.cpp')
-rw-r--r--src/mongo/db/index_names.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/index_names.cpp b/src/mongo/db/index_names.cpp
index 6a9aac30bc3..873f11c0f41 100644
--- a/src/mongo/db/index_names.cpp
+++ b/src/mongo/db/index_names.cpp
@@ -16,6 +16,8 @@
#include "mongo/db/index_names.h"
+#include "mongo/db/jsobj.h"
+
namespace mongo {
const string IndexNames::GEO_2D = "2d";
const string IndexNames::GEO_HAYSTACK = "geoHaystack";
@@ -23,4 +25,18 @@ namespace mongo {
const string IndexNames::TEXT = "text";
const string IndexNames::TEXT_INTERNAL = "_fts";
const string IndexNames::HASHED = "hashed";
+
+ // static
+ string IndexNames::findPluginName(const BSONObj& keyPattern) {
+ BSONObjIterator i(keyPattern);
+
+ while (i.more()) {
+ BSONElement e = i.next();
+ if (String != e.type()) { continue; }
+ return e.String();
+ }
+
+ return "";
+ }
+
} // namespace mongo