[SERVER-40251] Better validation error on insert and update Created: 20/Mar/19  Updated: 21/Mar/19  Resolved: 21/Mar/19

Status: Closed
Project: Core Server
Component/s: Logging
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Ihsan Mujdeci Assignee: Eric Sedor
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-20547 Expose the reason an operation fails ... Closed
Participants:

 Description   

When creating or updating an invalid document on a collection that has validation the error message that comes up is far too generic 

 

WriteResult({ 
    "nInserted" : 0, "writeError" : { 
        "code" : 121, "errmsg" : "Document failed validation" 
    } 
})

 

Could the team please implement something nicer that i possibly includes the description and or the key name 

like if the validation looked like

gpa: {
    bsonType: [ "double" ], description: "must be a double and is required" }

And somebody entered an incorrect validation the error message back could include 

validationErrors: [ Gpa must be a double and is required]

With the validation at its current state its pretty useless for an application level and the validation would need to be duplicated on the application level as well as the db level.

 

Thanks



 Comments   
Comment by Eric Sedor [ 21/Mar/19 ]

Hi ihsanm and thanks. We're tracking this feature request in SERVER-20547. Updates will be posted on that ticket as they happen.

Generated at Thu Feb 08 04:54:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.