Mongo Java Driver 4+ Issue with Constructor

92 Views Asked by At

I have an issue while migrating mongo version 3 to version 4.

With version 3 we have below constructor which accept 4 arguments

ObjectId(Date date, int machineIdentifier, short processIdentifier, int counter)

V3 API: https://api.mongodb.com/java/3.0/org/bson/types/ObjectId.html

With version 4, the above constructor has private access. So what will be an alternative to create ObjectId with machineIdentifier and processIdentifier?

V4 API: https://mongodb.github.io/mongo-java-driver/4.1/apidocs/bson/org/bson/types/ObjectId.html

And still document shows "Creates an ObjectId using the given time, machine identifier, process identifier, and counter." (Refer attached image) but constructor accepting 2 parameters only, seems like a mistake in the document?

enter image description here

0

There are 0 best solutions below