If you’re using MongoDB 5.0.0, 5.0.1, or 5.0.2, please upgrade to the latest version (5.0.4 currently). The same applies if you’re using the 4.4 series. Latest is 4.4.10 in the 4.4 series.
There was an issue that was detected in early versions of the 5.0 series that allows duplicate unique index entries (see SERVER-58936).
Best regards
Kevin