Search code examples
mongodbspring-bootexceptionerror-handling

What is the recommended HTTP status code to be used in the case of a duplicate key exception?


What is the recommended HTTP status code to be utilized in a REST API when a duplicate key error is detected in MongoDB? Despite researching the issue online, a definitive answer could not be found.


Solution

  • We can use status "409" for duplicate records.