summaryrefslogtreecommitdiff
path: root/src/mongo/db/index
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-06-22 18:19:31 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2016-07-08 10:16:56 -0400
commit99d405ae814d9840c029bcb6916cc94aa03b9b68 (patch)
treee313172e17b1a66ad840afa1b3cce0e7582de3c2 /src/mongo/db/index
parent44599a88f8f230d110363f638eb942ea7e071bf6 (diff)
downloadmongo-99d405ae814d9840c029bcb6916cc94aa03b9b68.tar.gz
SERVER-23924 Make _id index inherit the collection's default collation
Diffstat (limited to 'src/mongo/db/index')
-rw-r--r--src/mongo/db/index/index_access_method.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp
index d3ca3c0c808..93decde8b15 100644
--- a/src/mongo/db/index/index_access_method.cpp
+++ b/src/mongo/db/index/index_access_method.cpp
@@ -241,13 +241,20 @@ Status IndexAccessMethod::touch(OperationContext* txn) const {
}
RecordId IndexAccessMethod::findSingle(OperationContext* txn, const BSONObj& key) const {
+ // Generate the key for this index.
+ BSONObjSet keys;
+ MultikeyPaths* multikeyPaths = nullptr;
+ getKeys(key, &keys, multikeyPaths);
+ invariant(keys.size() == 1);
+
std::unique_ptr<SortedDataInterface::Cursor> cursor(_newInterface->newCursor(txn));
const auto requestedInfo = kDebugBuild ? SortedDataInterface::Cursor::kKeyAndLoc
: SortedDataInterface::Cursor::kWantLoc;
- if (auto kv = cursor->seekExact(key, requestedInfo)) {
+ if (auto kv = cursor->seekExact(*keys.begin(), requestedInfo)) {
// StorageEngine should guarantee these.
dassert(!kv->loc.isNull());
- dassert(kv->key.woCompare(key, /*order*/ BSONObj(), /*considerFieldNames*/ false) == 0);
+ dassert(kv->key.woCompare(
+ *keys.begin(), /*order*/ BSONObj(), /*considerFieldNames*/ false) == 0);
return kv->loc;
}