summaryrefslogtreecommitdiff
path: root/src/mongo/db/index/hash_access_method.cpp
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-04-29 12:17:05 -0400
committerHari Khalsa <hkhalsa@10gen.com>2013-05-02 15:57:13 -0400
commit41a2d01e419cabd2011ce4ce7262eb8b7181d9e7 (patch)
tree0bf766b83bda0090a853ec8d48e6c2f75d605d97 /src/mongo/db/index/hash_access_method.cpp
parentfc76b559266c4e2aee0707e6d640c08d20ff9e55 (diff)
downloadmongo-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.cpp19
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));
}