diff options
author | Keuin <[email protected]> | 2021-09-06 20:48:23 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2021-09-06 20:48:23 +0800 |
commit | d96d4ecac8e905108295c9ed98f945b9119fa2dc (patch) | |
tree | 26d808273451fc6b8fb5ac4e0d2b1936fb373843 /src/main | |
parent | 8e8e43a248e25dd9bea5cc4fc7d84c9cfcf1b2b0 (diff) |
Update dependency. Now supports Mongodb 5.x.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/keuin/blame/util/DatabaseUtil.java | 4 |
1 files changed, 3 insertions, 1 deletions
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 |