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()