In mongo-java-driver 3.8.0, ObjectId has a serialVersionUID=3670079982654483072L; The fields are: timestamp, machineIdentifier, processIdentifier, and counter.
In [mongo-java-driver 3.12.7|https://mongodb.github.io/mongo-java-driver/3.12/javadoc/org/bson/types/ObjectId.html], ObjectId has the same serialVersionUID=3670079982654483072L; However, the fields are different: timestamp, randomValue1, randomValue2, and counter.
The following scenario causes an issue: A BasicDBObject containing an ObjectId from version 3.8.0 is serialized into a byte array. Then that byte array is deserialized in a Java process containing mongo-java-driver 3.12.7, Java believes that the 2 ObjectIds contain the same fields due to the same serialVersionUID and therefore looks for the timestamp, randomValue1, randomValue2, and counter fields in the byte array. The randomValue1 and randomValue2 fields are not found (as the fields are really machineIdentifier and processIdentifier from 3.8.0) and thus, the middle 5 bytes are ignored and set to zeros. This causes the ObjectIds to be incorrect and causes a number of problems.
As a result, we are unable to upgrade mongo-java-driver from 3.8.0 to 3.12.7 because the ObjectIds are corrupted. Please fix!