-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
Networking & Observability, Service Arch
-
Fully Compatible
-
v8.0, v7.3, v7.0, v6.0
-
Security 2024-07-08
-
0
If we try to log an empty BSONElement, the logging system hits a MONGO_verify assertion. It is understandable that working with an empty BSONElement is not desired and should be caught through user error checking, but at the same time the following behavior difference is suprising:
TEST(ExampleLogFailureTest, FailEOO) { BSONObj doc = BSON("id" << 123); LOGV2(12345, "Going to hit a MONGO_verify", "elem"_attr = doc["nonexistentField"]); LOGV2(12345, "Works totally fine", "elem"_attr = doc["nonexistentField"].toString()); }
We should consider making this behavior clearer at the logging level or make the EOO element print as a string.