summaryrefslogtreecommitdiff
path: root/src/mongo/db/keypattern.cpp
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-04-11 16:22:55 -0400
committerHari Khalsa <hkhalsa@10gen.com>2013-04-12 16:40:38 -0400
commitef3d06fb6c5402d56a90ad60fd61c761021b92a7 (patch)
tree4097ad3c2fa71297977faddae8bc6c8028c3997e /src/mongo/db/keypattern.cpp
parent7797f459758a98bce90593e583f90c858a287a1c (diff)
downloadmongo-ef3d06fb6c5402d56a90ad60fd61c761021b92a7.tar.gz
migrate fts/haystack + add/del logic SERVER-8791 SERVER-9164 SERVER-9165
Diffstat (limited to 'src/mongo/db/keypattern.cpp')
-rw-r--r--src/mongo/db/keypattern.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/keypattern.cpp b/src/mongo/db/keypattern.cpp
index 7379c69bd2e..6c1bb6d67e6 100644
--- a/src/mongo/db/keypattern.cpp
+++ b/src/mongo/db/keypattern.cpp
@@ -40,6 +40,17 @@ namespace mongo {
}
}
+ bool KeyPattern::isIdKeyPattern(const BSONObj& pattern) {
+ BSONObjIterator i(pattern);
+ BSONElement e = i.next();
+ // _id index must have form exactly {_id : 1} or {_id : -1}.
+ // Allows an index of form {_id : "hashed"} to exist but
+ // do not consider it to be the primary _id index
+ return (0 == strcmp(e.fieldName(), "_id"))
+ && (e.numberInt() == 1 || e.numberInt() == -1)
+ && i.next().eoo();
+ }
+
string KeyPattern::findPluginName(const BSONObj& keyPattern) {
BSONObjIterator i(keyPattern);