Mongodb duplicate Unique index value

I also wanted to ask if the index was created after the duplicates were created or before