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. --- build.gradle | 8 +++++--- gradle.properties | 2 +- src/main/java/com/keuin/blame/util/DatabaseUtil.java | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 596eef1..ee15def 100644 --- a/build.gradle +++ b/build.gradle @@ -11,6 +11,8 @@ version = project.mod_version group = project.maven_group repositories { + mavenCentral() + // Add repositories to retrieve artifacts from in here. // You should only use this when depending on other mods because // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. @@ -29,9 +31,9 @@ dependencies { // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. // You may need to force-disable transitiveness on them. - implementation 'junit:junit:4.12' - implementation 'org.mongodb:mongo-java-driver:3.12.7' - include 'org.mongodb:mongo-java-driver:3.12.7' + implementation 'junit:junit:4.13.2' + implementation 'org.mongodb:mongodb-driver-sync:4.3.1' + implementation 'org.mongodb:bson:4.3.1' } processResources { diff --git a/gradle.properties b/gradle.properties index 78e3997..cd768f9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.16.5 yarn_mappings=1.16.5+build.10 loader_version=0.11.6 # Mod Properties -mod_version=1.5.0 +mod_version=1.5.1 maven_group=com.keuin.blame archives_base_name=blame-fabric # Dependencies 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