-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Server Programmability
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The IDL-defined timestamp and logicalTime types utilize BSONElement::timestamp for parsing, but this method is far too lenient with the types of inputs it accepts. For one, it will convert a BSON datetime (type 18) into a timestamp if the provided element is one. Secondly, if the element being parsed is neither a timestamp nor a datetime, a default-constructed timestamp is silently returned and no exception is thrown.
We should update this parsing to be more strict, ideally to only support timestamps and to error if another type is found. Otherwise, this could easily lead to accidental bugs.
notably, bsonExtractTimestamp has the desired behavior.
As part of this, we should update the fields currently using timestamp in read_concern.idl to use logicalTime.