diff options
author | David Storch <david.storch@10gen.com> | 2016-08-22 16:41:50 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-08-23 17:42:08 -0400 |
commit | f3be5348457ff71185ca9fa137ab7c1a8e4761df (patch) | |
tree | e2bdc25fab6568d577cb14f9905d593c07ee86e4 /src/mongo/dbtests/jsobjtests.cpp | |
parent | 6b5fd115d38582d8b349a5aad2c29867e69dc758 (diff) | |
download | mongo-f3be5348457ff71185ca9fa137ab7c1a8e4761df.tar.gz |
SERVER-24508 delete BSONObjCmp
Instead, use BSONObj::ComparatorInterface.
Diffstat (limited to 'src/mongo/dbtests/jsobjtests.cpp')
-rw-r--r-- | src/mongo/dbtests/jsobjtests.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp index 34dff8ada09..72d18905a5f 100644 --- a/src/mongo/dbtests/jsobjtests.cpp +++ b/src/mongo/dbtests/jsobjtests.cpp @@ -36,6 +36,7 @@ #include <cmath> #include <iostream> +#include "mongo/bson/bsonobj_comparator.h" #include "mongo/bson/util/builder.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/jsobj.h" @@ -59,6 +60,18 @@ using std::vector; namespace dps = ::mongo::dotted_path_support; +namespace { + +enum FieldCompareResult { + LEFT_SUBFIELD = -2, + LEFT_BEFORE = -1, + SAME = 0, + RIGHT_BEFORE = 1, + RIGHT_SUBFIELD = 2 +}; + +} // namespace + typedef std::map<std::string, BSONElement> BSONMap; BSONMap bson2map(const BSONObj& obj) { BSONMap m; @@ -1755,8 +1768,10 @@ public: } void test(BSONObj order, BSONObj l, BSONObj r, bool wanted) { - BSONObjCmp c(order); - bool got = c(l, r); + const StringData::ComparatorInterface* stringComparator = nullptr; + BSONObjComparator bsonCmp( + order, BSONObjComparator::FieldNamesMode::kConsider, stringComparator); + bool got = bsonCmp.makeLessThan()(l, r); if (got == wanted) return; cout << " order: " << order << " l: " << l << "r: " << r << " wanted: " << wanted |