I’m trying to do a save on Mongo while doing a create. I want to throw an error if Duplicate key is found (this is a composite key for me). When I try to save the data with same composite key, somehow it works and does not throw error which is weird.
I did follow steps mentioned here: https://www.baeldung.com/spring-data-mongodb-composite-key#1-testing-our-model
Can someone help to understand what might be happening here?