[CDRIVER-2256] Improve error message prefix for bulk write document validation errors Created: 25/Aug/17  Updated: 28/Oct/23  Resolved: 20/Nov/17

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.7.0
Fix Version/s: 1.9.0

Type: Improvement Priority: Minor - P4
Reporter: Jeremy Mikola Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

While reviewing CDRIVER-2250, I noticed that the following error message was used when inserting a document that contained a null byte in its string value:

document to insert contains invalid key: invalid utf8 string for key "x"

The first part of this message reads as if the key itself is invalid, when it is actually the value. In the past, most validation errors were due to keys (e.g. $ or dot characters), which might explain the original phrasing.

I believe the following functions are affected:

  • _mongoc_validate_new_document()
  • _mongoc_validate_replace()
  • _mongoc_validate_update()


 Comments   
Comment by Githook User [ 12/Dec/17 ]

Author:

{'name': 'Jeremy Mikola', 'email': 'jmikola@gmail.com', 'username': 'jmikola'}

Message: CDRIVER-2256 fix _mongoc_validate_update errmsg
Branch: r1.9
https://github.com/mongodb/mongo-c-driver/commit/68cfb8b3348c3ffa40e016b6c090b46742d65738

Comment by Githook User [ 12/Dec/17 ]

Author:

{'name': 'Jeremy Mikola', 'email': 'jmikola@gmail.com', 'username': 'jmikola'}

Message: CDRIVER-2256 fix _mongoc_validate_update errmsg
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/72629b723c573215c1689d4dca6c48186b2a2903

Comment by Githook User [ 20/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2256 accurate document-validation errors

The error messages mostly say "invalid key", but invalid values can also
cause errors.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/0c9cc9d26728d3cf4dd84e1fe91e75ca40e9a7fd

Generated at Wed Feb 07 21:14:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.