[JAVA-337] Unique IDs generated with the Java MongoDB driver do not conform to the documentation Created: 26/Apr/11  Updated: 31/Mar/15  Resolved: 25/Jun/13

Status: Closed
Project: Java Driver
Component/s: BSON
Affects Version/s: 2.5.3
Fix Version/s: 3.0.0

Type: Bug Priority: Minor - P4
Reporter: Rene Gallati Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by JAVA-578 The "inc" in ObjectId takes up one to... Closed
Related
related to JAVA-749 Make ObjectId conform to specification Closed
Backwards Compatibility: Fully Compatible

 Description   

Unique IDs generated with the Java MongoDB driver do NOT conform to the documentation both mongoDB generally and the javadoc included in the org.bson.types.ObjectID.

In particular, machineID and processID is 4 bytes, not 5 and Increment is 4 bytes, not 3, as would be expected and is documented. Knowledge of the precise structure is relevant when the _id is being manually generated or specific bytes modified to still ensure (distributed) uniqueness. In short: Documentation does not match implementation.



 Comments   
Comment by Jeffrey Yemin [ 31/Mar/15 ]

Closing all resolved 3.0.0 issues, as 3.0.0 has been tagged and released.

Comment by Jeffrey Yemin [ 25/Jun/13 ]

This is fixed by design in the 3.0.x branch. ServerAddress is now immutable and no longer caches the InetSocketAddress.

See

https://github.com/mongodb/mongo-java-driver/blob/3.0.x/driver/src/main/org/mongodb/connection/ServerAddress.java#L155

and

https://github.com/mongodb/mongo-java-driver/blob/3.0.x/driver/src/main/org/mongodb/connection/impl/DefaultConnection.java#L165

Comment by Jeffrey Yemin [ 27/Feb/13 ]

In 3.0, we're going to fix to make it conform to the spec.

Generated at Thu Feb 08 08:52:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.