Example expression:
{$dateAdd: { startDate: ISODate("2021-01-01T00:00:00.002Z"), amount: 3, unit: 'millisecond', }}
The startDate is 2 milliseconds after midnight, so I'd expect the result to be 5 milliseconds after midnight. Instead it's 3 milliseconds after midnight: the startDate's milliseconds are truncated before doing the addition.
It looks like we are truncating here because a timelib helper doesn't accept milliseconds: https://github.com/mongodb/mongo/blob/1eadaf115d098198845026aef15b0f24578b46b8/src/mongo/db/query/datetime/date_time_support.cpp#L1136
But the timelib struct does have a microseconds field we can populate: https://github.com/mongodb/mongo/blob/1eadaf115d098198845026aef15b0f24578b46b8/src/third_party/timelib-2021.04/timelib.h#L248