Java driver migration from 3.6 to 4.0

While migrating Mongo Java driver from 3.6.3 to 4.0.0, I found that MongoDB.util and MongoDB.bytes are deprecated in the newer version.

Is there an alternative that I can use? Since the above packages are deprecated, it results in compilation issues in code

com.mongodb.Bytes class is deprecated with Java driver v3.9. The deprecation note says: “there is no replacement for this class”.

Three classes (JSON, JSONCallback and JSONSerializers) in com.mongodb.util package are deprecated in Java Driver v3.5 (not Java driver v3.6).

The deprecation note says: "This class has been superseded by to toJson and parse methods on BasicDBObject", for all the three classes.

1 Like