Hi John,

My use case is more complex.
The duplicates are not always the same and I want to remove all items that appear more than once.

With this document :

{
    _id : "205734",
    productId: "205734",
    markets : [
        {
            salePeriods : [
                {
                    panel: {
                        storeSegmentations :[
                            { segmentationType: "C.WEB"},
                            { segmentationType: "SUPPLY_SIZES"},
                            { segmentationType: "SUPPLY_SIZES"},
                        ]
                    }
                },
                {
                    panel: {
                        storeSegmentations :[
                            { segmentationType: "C.WEB"},
                            { segmentationType: "SUPPLY_SIZES"},
                        ]
                    }
                }
            ]
        },
        {
            salePeriods : [
                {
                    panel: {
                        storeSegmentations :[
                            { segmentationType: "C.WEB"},
                            { segmentationType: "C.WEB"},
                            { segmentationType: "SUPPLY_SIZES"},
                        ]
                    }
                }
            ]
        }
    ]
}

Result should be :

{
    _id : "205734",
    productId: "205734",
    markets : [
        {
            salePeriods : [
                {
                    panel: {
                        storeSegmentations :[
                            { segmentationType: "C.WEB"}
                        ]
                    }
                },
                {
                    panel: {
                        storeSegmentations :[
                            { segmentationType: "C.WEB"},
                            { segmentationType: "SUPPLY_SIZES"}
                        ]
                    }
                }
            ]
        },
        {
            salePeriods : [
                {
                    panel: {
                        storeSegmentations :[
                            { segmentationType: "SUPPLY_SIZES"}
                        ]
                    }
                }
            ]
        }
    ]
}```