diff options
author | Kyle Suarez <kyle.suarez@mongodb.com> | 2017-09-20 14:31:17 -0400 |
---|---|---|
committer | Kyle Suarez <kyle.suarez@mongodb.com> | 2017-09-20 14:31:17 -0400 |
commit | 7a15db88968b9f6dd4418f4a89a2826c82b2ecac (patch) | |
tree | 7ee7b58ac2ace0609561c3c1467c0dded2753a5e /src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h | |
parent | 77bbdee3f8b59b1e070129616360f87e190a540b (diff) | |
download | mongo-7a15db88968b9f6dd4418f4a89a2826c82b2ecac.tar.gz |
SERVER-30695 uniqueItems must ignore field order when comparing documents
Diffstat (limited to 'src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h')
-rw-r--r-- | src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h b/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h index 570cf448f07..07beff92319 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h @@ -30,13 +30,16 @@ #include <utility> -#include "mongo/bson/bsonelement_comparator.h" +#include "mongo/bson/unordered_fields_bsonelement_comparator.h" #include "mongo/db/matcher/expression_array.h" namespace mongo { /** - * Matches arrays whose elements are all unique. + * Matches arrays whose elements are all unique. When comparing elements, + * + * - strings are always compared using the "simple" string comparator; and + * - objects are compared in a field order-independent manner. */ class InternalSchemaUniqueItemsMatchExpression final : public ArrayMatchingMatchExpression { public: @@ -81,6 +84,6 @@ public: private: // The comparator to use when comparing BSONElements, which will never use a collation. - BSONElementComparator _comparator{BSONElementComparator::FieldNamesMode::kIgnore, nullptr}; + UnorderedFieldsBSONElementComparator _comparator; }; } // namespace mongo |