How to flatten nested array.

Consider the following example dataset:

[
    {
        "slots": [
            {
                "rewards": [
                    {
                        "id": 0001,
                        "icon": "foo.jpg"
                    }
                ]
            },
            {
                "rewards": [
                    {
                        "id": 0002,
                        "icon": "bar.jpg"
                    },
                    {
                        "id": 0003,
                        "icon": null
                    }
                ]
            }
        ]
    }
]

Now I want to figure out all reward element with id but without icon, and turning them into a unique array.

I’ve already tried $concatArray and $unwind, but failed to flatten the nested array.

Share the expected results. It is not clear from the description what you want.