Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-40251

Better validation error on insert and update

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Logging
    • Labels:
      None

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              eric.sedor Eric Sedor
              Reporter:
              ihsanm Ihsan Mujdeci
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: