You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to create a document that contains a non unique attribute on a collection that has a Unique index, you are given a misleading and generic error such as:
Failed to insert document: Document with the requested ID already exists. Try again with a different ID or use ID.unique() to generate a unique ID.
The enhancement here, will be to call out which attribute is causing the exception.
🎤 Pitch
When returning exceptions, we need to be verbose and provide which attribute is causing the conflict.
For example, I have a Unique index on a column named email. [email protected] is already taken, but when trying to create a new document with the same value, it should not return Failed to insert document: Document with the requested ID already exists. Try again with a different ID or use ID.unique() to generate a unique ID., but instead return something like Failed to insert document: Duplicate key {$id} violates unique constraint on {$key}. Try again with a different ID or use ID.unique() to generate a unique ID.
👀 Have you spent some time to check if this issue has been raised before?
🔖 Feature description
When attempting to create a document that contains a non unique attribute on a collection that has a
Unique
index, you are given a misleading and generic error such as:Failed to insert document: Document with the requested ID already exists. Try again with a different ID or use ID.unique() to generate a unique ID.
The enhancement here, will be to call out which attribute is causing the exception.
🎤 Pitch
When returning exceptions, we need to be verbose and provide which attribute is causing the conflict.
For example, I have a
Unique
index on a column namedemail
.[email protected]
is already taken, but when trying to create a new document with the same value, it should not returnFailed to insert document: Document with the requested ID already exists. Try again with a different ID or use ID.unique() to generate a unique ID.
, but instead return something likeFailed to insert document: Duplicate key {$id} violates unique constraint on {$key}. Try again with a different ID or use ID.unique() to generate a unique ID.
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: