diff options
Diffstat (limited to 'src/mongo/db/catalog/index_catalog.cpp')
-rw-r--r-- | src/mongo/db/catalog/index_catalog.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index c6c6a9fa034..4690b5daa46 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -36,6 +36,7 @@ #include <vector> +#include "mongo/bson/simple_bsonobj_comparator.h" #include "mongo/db/audit.h" #include "mongo/db/background.h" #include "mongo/db/catalog/collection.h" @@ -665,7 +666,8 @@ Status IndexCatalog::_doesSpecConflictWithExisting(OperationContext* txn, // index already exists with same name if (desc->keyPattern().equal(key) && - desc->infoObj().getObjectField("collation") != collation) { + SimpleBSONObjComparator::kInstance.evaluate( + desc->infoObj().getObjectField("collation") != collation)) { // key patterns are equal but collations differ. return Status(ErrorCodes::IndexOptionsConflict, str::stream() @@ -679,7 +681,8 @@ Status IndexCatalog::_doesSpecConflictWithExisting(OperationContext* txn, } if (!desc->keyPattern().equal(key) || - desc->infoObj().getObjectField("collation") != collation) { + SimpleBSONObjComparator::kInstance.evaluate( + desc->infoObj().getObjectField("collation") != collation)) { return Status(ErrorCodes::IndexKeySpecsConflict, str::stream() << "Index must have unique name." << "The existing index: " @@ -1078,9 +1081,11 @@ IndexDescriptor* IndexCatalog::findIndexByKeyPatternAndCollationSpec( IndexIterator ii = getIndexIterator(txn, includeUnfinishedIndexes); while (ii.more()) { IndexDescriptor* desc = ii.next(); - if (desc->keyPattern() == key && - desc->infoObj().getObjectField("collation") == collationSpec) + if (SimpleBSONObjComparator::kInstance.evaluate(desc->keyPattern() == key) && + SimpleBSONObjComparator::kInstance.evaluate( + desc->infoObj().getObjectField("collation") == collationSpec)) { return desc; + } } return NULL; } @@ -1093,7 +1098,7 @@ void IndexCatalog::findIndexesByKeyPattern(OperationContext* txn, IndexIterator ii = getIndexIterator(txn, includeUnfinishedIndexes); while (ii.more()) { IndexDescriptor* desc = ii.next(); - if (desc->keyPattern() == key) { + if (SimpleBSONObjComparator::kInstance.evaluate(desc->keyPattern() == key)) { matches->push_back(desc); } } |