Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-478

Errors raised by drivers should include codeName string from server response

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: None
    • Labels:
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      JAVA-2843 Fixed 3.8.0
      NODE-1447 Works as Designed
      CSHARP-2256 Fixed 2.7.0
      RUBY-1331 Fixed 2.6.0
      CXX-1570 Backlog
      MOTOR-215 Fixed 2.0
      GODRIVER-394 Done
      CDRIVER-2635 Works as Designed 1.11.0
      RUST-173 Backlog
      SWIFT-489 Fixed 0.2.0
      CDRIVER-3147 Blocked
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion JAVA-2843 Fixed 3.8.0 NODE-1447 Works as Designed CSHARP-2256 Fixed 2.7.0 RUBY-1331 Fixed 2.6.0 CXX-1570 Backlog MOTOR-215 Fixed 2.0 GODRIVER-394 Done CDRIVER-2635 Works as Designed 1.11.0 RUST-173 Backlog SWIFT-489 Fixed 0.2.0 CDRIVER-3147 Blocked

      As of MongoDB 3.4, error responses from the server include not only the error code and message, but also a stringified representation of the error code, in the codeName field. Drivers should ensure that this code name is accessible from any errors that are returned or exceptions that are raised based on error responses from the server.

      Example responses:

      MongoDB Enterprise repl0:PRIMARY> db.runCommand({insert: "test", documents: []})
      {
      	"operationTime" : Timestamp(1524837772, 1),
      	"ok" : 0,
      	"errmsg" : "Write batch sizes must be between 1 and 100000. Got 0 operations.",
      	"code" : 16,
      	"codeName" : "InvalidLength",
      }
      
      MongoDB Enterprise repl0:PRIMARY> db.runCommand({insert: "test", writeConcern: {w: 10}, documents: [{_id: 2}]})
      {
      	"n" : 1,
      	"opTime" : {
      		"ts" : Timestamp(1524837850, 1),
      		"t" : NumberLong(15)
      	},
      	"electionId" : ObjectId("7fffffff000000000000000f"),
      	"writeConcernError" : {
      		"code" : 100,
      		"codeName" : "CannotSatisfyWriteConcern",
      		"errmsg" : "Not enough data-bearing nodes"
      	},
      	"ok" : 1,
      	"operationTime" : Timestamp(1524837850, 1),
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1524837850, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      }
      

      Note that a writeConcernError document can also contain a codeName embedded within it. No evidence that the documents within the writeErrors array field do the same.

            Assignee:
            Unassigned Unassigned
            Reporter:
            rathi.gnanasekaran Rathi Gnanasekaran
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: