From 240a99c2602a851ad722fdfa3258cd62ef2148b3 Mon Sep 17 00:00:00 2001 From: srnyx <25808801+srnyx@users.noreply.github.com> Date: Sat, 28 Sep 2024 17:29:59 -0400 Subject: [PATCH] Update mongodb-driver-sync and annotations mongodv-driver-sync: 5.1.4 -> 5.2.0 annotations: 24.1.0 -> 25.0.0 --- build.gradle.kts | 4 ++-- .../java/xyz/srnyx/magicmongo/MagicCollection.java | 9 +++++++++ src/main/java/xyz/srnyx/magicmongo/MagicDatabase.java | 10 ++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 019a122..b20dfbb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,8 +16,8 @@ setupJava("xyz.srnyx", "1.2.2", "Common framework for srnyx's MongoDB management repository(Repository.MAVEN_CENTRAL) dependencies { - implementation("org.mongodb", "mongodb-driver-sync", "5.1.4") - compileOnly("org.jetbrains" , "annotations", "24.1.0") + implementation("org.mongodb", "mongodb-driver-sync", "5.2.0") + compileOnly("org.jetbrains" , "annotations", "25.0.0") } setupPublishing( diff --git a/src/main/java/xyz/srnyx/magicmongo/MagicCollection.java b/src/main/java/xyz/srnyx/magicmongo/MagicCollection.java index 922af97..1960e8f 100644 --- a/src/main/java/xyz/srnyx/magicmongo/MagicCollection.java +++ b/src/main/java/xyz/srnyx/magicmongo/MagicCollection.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.concurrent.TimeUnit; /** @@ -448,6 +449,10 @@ public WriteConcern getWriteConcern() { public ReadConcern getReadConcern() { return collection.getReadConcern(); } + @Override @Nullable + public Long getTimeout(@NotNull TimeUnit timeUnit) { + return collection.getTimeout(timeUnit); + } @Override @NotNull public MongoCollection withDocumentClass(@NotNull Class clazz) { return collection.withDocumentClass(clazz); @@ -468,6 +473,10 @@ public MongoCollection withWriteConcern(@NotNull WriteConcern writeConcern) { public MongoCollection withReadConcern(@NotNull ReadConcern readConcern) { return collection.withReadConcern(readConcern); } + @Override @NotNull + public MongoCollection withTimeout(long timeout, @NotNull TimeUnit timeUnit) { + return collection.withTimeout(timeout, timeUnit); + } @Override public long countDocuments() { return collection.countDocuments(); diff --git a/src/main/java/xyz/srnyx/magicmongo/MagicDatabase.java b/src/main/java/xyz/srnyx/magicmongo/MagicDatabase.java index b749d9f..eebfd40 100644 --- a/src/main/java/xyz/srnyx/magicmongo/MagicDatabase.java +++ b/src/main/java/xyz/srnyx/magicmongo/MagicDatabase.java @@ -12,10 +12,12 @@ import org.bson.conversions.Bson; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; /** @@ -145,6 +147,10 @@ public WriteConcern getWriteConcern() { public ReadConcern getReadConcern() { return database.getReadConcern(); } + @Override @Nullable + public Long getTimeout(@NotNull TimeUnit timeUnit) { + return database.getTimeout(timeUnit); + } @Override @NotNull public MongoDatabase withCodecRegistry(@NotNull CodecRegistry codecRegistry) { return database.withCodecRegistry(codecRegistry); @@ -162,6 +168,10 @@ public MongoDatabase withReadConcern(@NotNull ReadConcern readConcern) { return database.withReadConcern(readConcern); } @Override @NotNull + public MongoDatabase withTimeout(long timeout, @NotNull TimeUnit timeUnit) { + return database.withTimeout(timeout, timeUnit); + } + @Override @NotNull public MongoCollection getCollection(@NotNull String collectionName) { return database.getCollection(collectionName); }