diff options
author | David Storch <david.storch@10gen.com> | 2016-08-12 15:58:56 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-08-18 11:14:17 -0400 |
commit | 26543060c852aac22f26143a04bf7789ec8fec53 (patch) | |
tree | df3ae49e5c4745058be29b7ec8a8e4b528b50a9a /src/mongo/db/s/split_vector_command.cpp | |
parent | 13fa28982d008568f7620d73ddec0c61fad7cbc8 (diff) | |
download | mongo-26543060c852aac22f26143a04bf7789ec8fec53.tar.gz |
SERVER-24508 BSONObj::ComparatorInterface
BSONObj instances should now be compared via the comparator
interface's evaluate() method. This preferred over using
BSONObj::woCompare() directly. If the comparison doesn't
require any database semantics (e.g. there is no collation),
there is a global instance of the SimpleBSONObjComparator
which should be used for BSONObj comparisons. If the
comparison requires special semantics, then callers must
instantiate their own comparator object.
Diffstat (limited to 'src/mongo/db/s/split_vector_command.cpp')
-rw-r--r-- | src/mongo/db/s/split_vector_command.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/s/split_vector_command.cpp b/src/mongo/db/s/split_vector_command.cpp index 5ed698daad1..e00377e5a13 100644 --- a/src/mongo/db/s/split_vector_command.cpp +++ b/src/mongo/db/s/split_vector_command.cpp @@ -34,6 +34,7 @@ #include <string> #include <vector> +#include "mongo/bson/simple_bsonobj_comparator.h" #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/action_type.h" #include "mongo/db/auth/authorization_manager.h" @@ -271,7 +272,7 @@ public: // Use every 'keyCount'-th key as a split point. We add the initial key as a sentinel, // to be removed at the end. If a key appears more times than entries allowed on a // chunk, we issue a warning and split on the following key. - set<BSONObj> tooFrequentKeys; + auto tooFrequentKeys = SimpleBSONObjComparator::kInstance.makeOrderedBSONObjSet(); splitKeys.push_back(dps::extractElementsBasedOnTemplate( prettyKey(idx->keyPattern(), currKey.getOwned()), keyPattern)); @@ -371,9 +372,8 @@ public: } // Make sure splitKeys is in ascending order - std::sort(splitKeys.begin(), - splitKeys.end(), - [](const BSONObj& lhs, const BSONObj& rhs) -> bool { return lhs < rhs; }); + std::sort( + splitKeys.begin(), splitKeys.end(), SimpleBSONObjComparator::kInstance.makeLessThan()); result.append("splitKeys", splitKeys); return true; } |