Concept Flow - Unique index behavior
Create Unique Index
Insert Document
Check if value exists in index
Reject Insert
Error: Duplicate
End
When inserting a document, MongoDB checks the unique index for duplicates. If a duplicate exists, insertion is rejected with an error; otherwise, the document is added.