From d96d4ecac8e905108295c9ed98f945b9119fa2dc Mon Sep 17 00:00:00 2001 From: Keuin Date: Mon, 6 Sep 2021 20:48:23 +0800 Subject: Update dependency. Now supports Mongodb 5.x. --- src/main/java/com/keuin/blame/util/DatabaseUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/com/keuin/blame/util/DatabaseUtil.java b/src/main/java/com/keuin/blame/util/DatabaseUtil.java index 5ffbedf..8d8b2ad 100644 --- a/src/main/java/com/keuin/blame/util/DatabaseUtil.java +++ b/src/main/java/com/keuin/blame/util/DatabaseUtil.java @@ -7,6 +7,7 @@ import com.keuin.blame.data.enums.codec.ObjectTypeCodec; import com.keuin.blame.data.enums.codec.WorldPosCodec; import com.mongodb.ConnectionString; import com.mongodb.MongoClientSettings; +import org.bson.UuidRepresentation; import org.bson.codecs.configuration.CodecRegistries; import org.bson.codecs.configuration.CodecRegistry; import org.bson.codecs.pojo.PojoCodecProvider; @@ -20,7 +21,7 @@ public class DatabaseUtil { public static final MongoConfig MONGO_CONFIG = Blame.config.getMongoConfig(); public static final CodecRegistry CODEC_REGISTRY = CodecRegistries.fromRegistries( - com.mongodb.MongoClient.getDefaultCodecRegistry(), + MongoClientSettings.getDefaultCodecRegistry(), CodecRegistries.fromCodecs( new ActionTypeCodec(), new ObjectTypeCodec(), @@ -31,6 +32,7 @@ public class DatabaseUtil { public static final MongoClientSettings CLIENT_SETTINGS = MongoClientSettings.builder() .applyConnectionString(new ConnectionString(MONGO_CONFIG.getAddress())) .codecRegistry(CODEC_REGISTRY) + .uuidRepresentation(UuidRepresentation.JAVA_LEGACY) // for backward-compatible with logs created by older versions .build(); // TODO: Auto create indexes if the collection is empty -- cgit v1.2.3