diff options
author | Hari Khalsa <hkhalsa@10gen.com> | 2013-04-29 12:17:05 -0400 |
---|---|---|
committer | Hari Khalsa <hkhalsa@10gen.com> | 2013-05-02 15:57:13 -0400 |
commit | 41a2d01e419cabd2011ce4ce7262eb8b7181d9e7 (patch) | |
tree | 0bf766b83bda0090a853ec8d48e6c2f75d605d97 /src/mongo/db/index/hash_access_method.cpp | |
parent | fc76b559266c4e2aee0707e6d640c08d20ff9e55 (diff) | |
download | mongo-41a2d01e419cabd2011ce4ce7262eb8b7181d9e7.tar.gz |
SERVER-8791 SERVER-9212 retire indexplugin/indextype
Diffstat (limited to 'src/mongo/db/index/hash_access_method.cpp')
-rw-r--r-- | src/mongo/db/index/hash_access_method.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mongo/db/index/hash_access_method.cpp b/src/mongo/db/index/hash_access_method.cpp index d547f7fce1b..13a966fecf0 100644 --- a/src/mongo/db/index/hash_access_method.cpp +++ b/src/mongo/db/index/hash_access_method.cpp @@ -28,6 +28,20 @@ namespace mongo { return BSONElementHasher::hash64(e, seed); } + BSONObj HashAccessMethod::getMissingField(const IndexDetails& details) { + BSONObj infoObj = details.info.obj(); + int hashVersion = infoObj["hashVersion"].numberInt(); + HashSeed seed = infoObj["seed"].numberInt(); + + // Explicit null valued fields and missing fields are both represented in hashed indexes + // using the hash value of the null BSONElement. This is partly for historical reasons + // (hash of null was used in the initial release of hashed indexes and changing would alter + // the data format). Additionally, in certain places the hashed index code and the index + // bound calculation code assume null and missing are indexed identically. + BSONObj nullObj = BSON("" << BSONNULL); + return BSON("" << makeSingleKey(nullObj.firstElement(), seed, hashVersion)); + } + HashAccessMethod::HashAccessMethod(IndexDescriptor* descriptor) : BtreeBasedAccessMethod(descriptor) { @@ -56,11 +70,6 @@ namespace mongo { firstElt.str().compare(HASHED_INDEX_TYPE_IDENTIFIER) == 0); _hashedField = firstElt.fieldName(); - // Explicit null valued fields and missing fields are both represented in hashed indexes - // using the hash value of the null BSONElement. This is partly for historical reasons - // (hash of null was used in the initial release of hashed indexes and changing would alter - // the data format). Additionally, in certain places the hashed index code and the index - // bound calculation code assume null and missing are indexed identically. BSONObj nullObj = BSON("" << BSONNULL); _missingKey = BSON("" << makeSingleKey(nullObj.firstElement(), _seed, _hashVersion)); } |