Skip to content

CRUD service response on unique constraint violation #175

Answered by silversoul93
malta895 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @malta895, looking at the source code of the crud-service seems like right now you can get a 422 only for this kind of error during an insert or bulk insert operation.

I don't know if, in the future, other cases could be added.

Since the eventual addition of a new 422 response status code is not a breaking change probably you should parse the message.

According to the MongoDB Documentation, E11000 is the "duplicate key" error, so it should be safe (for now at least).

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@malta895
Comment options

malta895 Jan 19, 2023
Collaborator Author

@silversoul93
Comment options

@fredmaggiowski
Comment options

@TheRusCompass
Comment options

Answer selected by malta895
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
CRUD Service Any question related to Mia Platform CRUD Service
4 participants