summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h
diff options
context:
space:
mode:
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.h9
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