From 6951c289a5dcb2568247ce7897f1920b1ec70abf Mon Sep 17 00:00:00 2001 From: Jeff Yemin Date: Mon, 6 Nov 2023 17:24:29 -0500 Subject: [PATCH] Remove deprecated oplogReplay-related methods JAVA-5150 --- config/detekt/baseline.xml | 4 +-- .../internal/client/model/FindOptions.java | 26 ++----------------- .../internal/operation/FindOperation.java | 13 ---------- .../internal/operation/Operations.java | 1 - .../FindOperationSpecification.groovy | 4 --- .../model/FindOptionsSpecification.groovy | 9 ------- .../FindOperationUnitSpecification.groovy | 3 --- .../coroutine/syncadapter/SyncFindIterable.kt | 4 --- .../kotlin/client/coroutine/FindFlow.kt | 11 -------- .../kotlin/client/coroutine/FindFlowTest.kt | 10 +------ .../client/syncadapter/SyncFindIterable.kt | 4 --- .../com/mongodb/kotlin/client/FindIterable.kt | 11 -------- .../mongodb/kotlin/client/FindIterableTest.kt | 10 +------ .../src/main/com/mongodb/DBCursor.java | 16 ------------ .../client/model/DBCollectionFindOptions.java | 26 ------------------- .../com/mongodb/DBCursorSpecification.groovy | 4 --- ...BCollectionFindOptionsSpecification.groovy | 5 ---- .../reactivestreams/client/FindPublisher.java | 10 ------- .../client/internal/FindPublisherImpl.java | 7 ----- .../client/syncadapter/SyncFindIterable.java | 7 ----- .../internal/FindPublisherImplTest.java | 2 -- .../scala/syncadapter/SyncFindIterable.scala | 5 ---- .../org/mongodb/scala/FindObservable.scala | 15 ++--------- .../mongodb/scala/FindObservableSpec.scala | 6 ++--- .../main/com/mongodb/client/FindIterable.java | 10 ------- .../client/internal/FindIterableImpl.java | 7 ----- .../internal/FindIterableSpecification.groovy | 3 --- 27 files changed, 10 insertions(+), 223 deletions(-) diff --git a/config/detekt/baseline.xml b/config/detekt/baseline.xml index c899728c7be..5d6b5a9fec1 100644 --- a/config/detekt/baseline.xml +++ b/config/detekt/baseline.xml @@ -4,8 +4,8 @@ IteratorNotThrowingNoSuchElementException:MongoCursor.kt$MongoCursor<T : Any> : IteratorCloseable LargeClass:MongoCollectionTest.kt$MongoCollectionTest - LongMethod:FindFlowTest.kt$FindFlowTest$@Suppress("DEPRECATION") @Test fun shouldCallTheUnderlyingMethods() - LongMethod:FindIterableTest.kt$FindIterableTest$@Suppress("DEPRECATION") @Test fun shouldCallTheUnderlyingMethods() + LongMethod:FindFlowTest.kt$FindFlowTest$@Test fun shouldCallTheUnderlyingMethods() + LongMethod:FindIterableTest.kt$FindIterableTest$@Test fun shouldCallTheUnderlyingMethods() LongMethod:KotlinSerializerCodecTest.kt$KotlinSerializerCodecTest$@Test fun testDataClassOptionalBsonValues() MaxLineLength:MapReduceFlow.kt$MapReduceFlow$* MaxLineLength:MapReduceIterable.kt$MapReduceIterable$* diff --git a/driver-core/src/main/com/mongodb/internal/client/model/FindOptions.java b/driver-core/src/main/com/mongodb/internal/client/model/FindOptions.java index f92885ae9fc..3a87434e9ed 100644 --- a/driver-core/src/main/com/mongodb/internal/client/model/FindOptions.java +++ b/driver-core/src/main/com/mongodb/internal/client/model/FindOptions.java @@ -43,7 +43,6 @@ public final class FindOptions { private Bson sort; private CursorType cursorType = CursorType.NonTailable; private boolean noCursorTimeout; - private boolean oplogReplay; private boolean partial; private Collation collation; private BsonValue comment; @@ -65,7 +64,7 @@ public FindOptions() { //CHECKSTYLE:OFF FindOptions( final int batchSize, final int limit, final Bson projection, final long maxTimeMS, final long maxAwaitTimeMS, final int skip, - final Bson sort, final CursorType cursorType, final boolean noCursorTimeout, final boolean oplogReplay, final boolean partial, + final Bson sort, final CursorType cursorType, final boolean noCursorTimeout, final boolean partial, final Collation collation, final BsonValue comment, final Bson hint, final String hintString, final Bson variables, final Bson max, final Bson min, final boolean returnKey, final boolean showRecordId, final Boolean allowDiskUse) { this.batchSize = batchSize; @@ -77,7 +76,6 @@ public FindOptions() { this.sort = sort; this.cursorType = cursorType; this.noCursorTimeout = noCursorTimeout; - this.oplogReplay = oplogReplay; this.partial = partial; this.collation = collation; this.comment = comment; @@ -94,7 +92,7 @@ public FindOptions() { public FindOptions withBatchSize(final int batchSize) { return new FindOptions(batchSize, limit, projection, maxTimeMS, maxAwaitTimeMS, skip, sort, cursorType, noCursorTimeout, - oplogReplay, partial, collation, comment, hint, hintString, variables, max, min, returnKey, showRecordId, allowDiskUse); + partial, collation, comment, hint, hintString, variables, max, min, returnKey, showRecordId, allowDiskUse); } /** @@ -295,26 +293,6 @@ public FindOptions noCursorTimeout(final boolean noCursorTimeout) { return this; } - /** - * Users should not set this under normal circumstances. - * - * @return if oplog replay is enabled - */ - public boolean isOplogReplay() { - return oplogReplay; - } - - /** - * Users should not set this under normal circumstances. - * - * @param oplogReplay if oplog replay is enabled - * @return this - */ - public FindOptions oplogReplay(final boolean oplogReplay) { - this.oplogReplay = oplogReplay; - return this; - } - /** * Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error). * diff --git a/driver-core/src/main/com/mongodb/internal/operation/FindOperation.java b/driver-core/src/main/com/mongodb/internal/operation/FindOperation.java index dcb94211fcf..5ca9f788054 100644 --- a/driver-core/src/main/com/mongodb/internal/operation/FindOperation.java +++ b/driver-core/src/main/com/mongodb/internal/operation/FindOperation.java @@ -85,7 +85,6 @@ public class FindOperation implements AsyncExplainableReadOperation cursorType(final CursorType cursorType) { return this; } - public boolean isOplogReplay() { - return oplogReplay; - } - - public FindOperation oplogReplay(final boolean oplogReplay) { - this.oplogReplay = oplogReplay; - return this; - } - public boolean isNoCursorTimeout() { return noCursorTimeout; } @@ -420,9 +410,6 @@ private BsonDocument getCommand(final SessionContext sessionContext, final int m if (isAwaitData()) { commandDocument.put("awaitData", BsonBoolean.TRUE); } - if (oplogReplay) { - commandDocument.put("oplogReplay", BsonBoolean.TRUE); - } if (noCursorTimeout) { commandDocument.put("noCursorTimeout", BsonBoolean.TRUE); } diff --git a/driver-core/src/main/com/mongodb/internal/operation/Operations.java b/driver-core/src/main/com/mongodb/internal/operation/Operations.java index ac39e1a1f3c..d55e25dc449 100644 --- a/driver-core/src/main/com/mongodb/internal/operation/Operations.java +++ b/driver-core/src/main/com/mongodb/internal/operation/Operations.java @@ -197,7 +197,6 @@ private FindOperation createFindOperation(final MongoNamespac .sort(toBsonDocument(options.getSort())) .cursorType(options.getCursorType()) .noCursorTimeout(options.isNoCursorTimeout()) - .oplogReplay(options.isOplogReplay()) .partial(options.isPartial()) .collation(options.getCollation()) .comment(options.getComment()) diff --git a/driver-core/src/test/functional/com/mongodb/internal/operation/FindOperationSpecification.groovy b/driver-core/src/test/functional/com/mongodb/internal/operation/FindOperationSpecification.groovy index 31de9603527..534534a576a 100644 --- a/driver-core/src/test/functional/com/mongodb/internal/operation/FindOperationSpecification.groovy +++ b/driver-core/src/test/functional/com/mongodb/internal/operation/FindOperationSpecification.groovy @@ -95,7 +95,6 @@ class FindOperationSpecification extends OperationFunctionalSpecification { operation.getProjection() == null operation.getCollation() == null !operation.isNoCursorTimeout() - !operation.isOplogReplay() !operation.isPartial() operation.isAllowDiskUse() == null } @@ -119,7 +118,6 @@ class FindOperationSpecification extends OperationFunctionalSpecification { .cursorType(Tailable) .collation(defaultCollation) .partial(true) - .oplogReplay(true) .noCursorTimeout(true) .allowDiskUse(true) @@ -134,7 +132,6 @@ class FindOperationSpecification extends OperationFunctionalSpecification { operation.getProjection() == projection operation.getCollation() == defaultCollation operation.isNoCursorTimeout() - operation.isOplogReplay() operation.isPartial() operation.isAllowDiskUse() } @@ -709,7 +706,6 @@ class FindOperationSpecification extends OperationFunctionalSpecification { def operation = new FindOperation(namespace, new BsonDocumentCodec()) .noCursorTimeout(true) .partial(true) - .oplogReplay(true) when: execute(operation, async) diff --git a/driver-core/src/test/unit/com/mongodb/client/model/FindOptionsSpecification.groovy b/driver-core/src/test/unit/com/mongodb/client/model/FindOptionsSpecification.groovy index 3ca239ef53a..380d305cb28 100644 --- a/driver-core/src/test/unit/com/mongodb/client/model/FindOptionsSpecification.groovy +++ b/driver-core/src/test/unit/com/mongodb/client/model/FindOptionsSpecification.groovy @@ -44,7 +44,6 @@ class FindOptionsSpecification extends Specification { options.getBatchSize() == 0 options.getCursorType() == CursorType.NonTailable !options.isNoCursorTimeout() - !options.isOplogReplay() !options.isPartial() !options.isAllowDiskUse() } @@ -113,14 +112,6 @@ class FindOptionsSpecification extends Specification { partial << [true, false] } - def 'should set oplogReplay'() { - expect: - new FindOptions().oplogReplay(oplogReplay).isOplogReplay() == oplogReplay - - where: - oplogReplay << [true, false] - } - def 'should set noCursorTimeout'() { expect: new FindOptions().noCursorTimeout(noCursorTimeout).isNoCursorTimeout() == noCursorTimeout diff --git a/driver-core/src/test/unit/com/mongodb/internal/operation/FindOperationUnitSpecification.groovy b/driver-core/src/test/unit/com/mongodb/internal/operation/FindOperationUnitSpecification.groovy index 0128b4158ee..b2bd9019ef5 100644 --- a/driver-core/src/test/unit/com/mongodb/internal/operation/FindOperationUnitSpecification.groovy +++ b/driver-core/src/test/unit/com/mongodb/internal/operation/FindOperationUnitSpecification.groovy @@ -47,10 +47,8 @@ class FindOperationUnitSpecification extends OperationUnitSpecification { .limit(limit) .batchSize(batchSize) .cursorType(TailableAwait) - .oplogReplay(true) .noCursorTimeout(true) .partial(true) - .oplogReplay(true) .maxTime(10, MILLISECONDS) .comment(new BsonString('my comment')) .hint(BsonDocument.parse('{ hint : 1}')) @@ -70,7 +68,6 @@ class FindOperationUnitSpecification extends OperationUnitSpecification { .append('awaitData', BsonBoolean.TRUE) .append('allowPartialResults', BsonBoolean.TRUE) .append('noCursorTimeout', BsonBoolean.TRUE) - .append('oplogReplay', BsonBoolean.TRUE) .append('maxTimeMS', new BsonInt64(operation.getMaxTime(MILLISECONDS))) .append('comment', operation.getComment()) .append('hint', operation.getHint()) diff --git a/driver-kotlin-coroutine/src/integration/kotlin/com/mongodb/kotlin/client/coroutine/syncadapter/SyncFindIterable.kt b/driver-kotlin-coroutine/src/integration/kotlin/com/mongodb/kotlin/client/coroutine/syncadapter/SyncFindIterable.kt index 49ba1d49f58..b9e3a6665d6 100644 --- a/driver-kotlin-coroutine/src/integration/kotlin/com/mongodb/kotlin/client/coroutine/syncadapter/SyncFindIterable.kt +++ b/driver-kotlin-coroutine/src/integration/kotlin/com/mongodb/kotlin/client/coroutine/syncadapter/SyncFindIterable.kt @@ -26,7 +26,6 @@ import org.bson.BsonValue import org.bson.Document import org.bson.conversions.Bson -@Suppress("DEPRECATION") data class SyncFindIterable(val wrapped: FindFlow) : JFindIterable, SyncMongoIterable(wrapped) { override fun batchSize(batchSize: Int): SyncFindIterable = apply { wrapped.batchSize(batchSize) } override fun filter(filter: Bson?): SyncFindIterable = apply { wrapped.filter(filter) } @@ -55,9 +54,6 @@ data class SyncFindIterable(val wrapped: FindFlow) : JFindIterable = apply { wrapped.oplogReplay(oplogReplay) } - override fun partial(partial: Boolean): SyncFindIterable = apply { wrapped.partial(partial) } override fun cursorType(cursorType: CursorType): SyncFindIterable = apply { wrapped.cursorType(cursorType) } diff --git a/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/FindFlow.kt b/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/FindFlow.kt index ed0992b1bf7..49a391c236f 100644 --- a/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/FindFlow.kt +++ b/driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/FindFlow.kt @@ -131,17 +131,6 @@ public class FindFlow(private val wrapped: FindPublisher) : Flow wrapped.noCursorTimeout(noCursorTimeout) } - /** - * Users should not set this under normal circumstances. - * - * @param oplogReplay if oplog replay is enabled - * @return this - * @deprecated oplogReplay has been deprecated in MongoDB 4.4. - */ - @Suppress("DEPRECATION") - @Deprecated("oplogReplay has been deprecated in MongoDB 4.4", replaceWith = ReplaceWith("")) - public fun oplogReplay(oplogReplay: Boolean): FindFlow = apply { wrapped.oplogReplay(oplogReplay) } - /** * Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error). * diff --git a/driver-kotlin-coroutine/src/test/kotlin/com/mongodb/kotlin/client/coroutine/FindFlowTest.kt b/driver-kotlin-coroutine/src/test/kotlin/com/mongodb/kotlin/client/coroutine/FindFlowTest.kt index d86b0daef99..2216c044883 100644 --- a/driver-kotlin-coroutine/src/test/kotlin/com/mongodb/kotlin/client/coroutine/FindFlowTest.kt +++ b/driver-kotlin-coroutine/src/test/kotlin/com/mongodb/kotlin/client/coroutine/FindFlowTest.kt @@ -27,12 +27,7 @@ import org.bson.BsonDocument import org.bson.BsonString import org.bson.Document import org.junit.jupiter.api.Test -import org.mockito.kotlin.doReturn -import org.mockito.kotlin.mock -import org.mockito.kotlin.times -import org.mockito.kotlin.verify -import org.mockito.kotlin.verifyNoMoreInteractions -import org.mockito.kotlin.whenever +import org.mockito.kotlin.* import reactor.core.publisher.Mono class FindFlowTest { @@ -44,7 +39,6 @@ class FindFlowTest { assertEquals(jFindPublisherFunctions, kFindFlowFunctions) } - @Suppress("DEPRECATION") @Test fun shouldCallTheUnderlyingMethods() { val wrapped: FindPublisher = mock() @@ -77,7 +71,6 @@ class FindFlowTest { flow.maxTime(1) flow.maxTime(1, TimeUnit.SECONDS) flow.min(bson) - flow.oplogReplay(true) flow.noCursorTimeout(true) flow.partial(true) flow.projection(bson) @@ -103,7 +96,6 @@ class FindFlowTest { verify(wrapped).maxTime(1, TimeUnit.MILLISECONDS) verify(wrapped).maxTime(1, TimeUnit.SECONDS) verify(wrapped).min(bson) - verify(wrapped).oplogReplay(true) verify(wrapped).noCursorTimeout(true) verify(wrapped).partial(true) verify(wrapped).projection(bson) diff --git a/driver-kotlin-sync/src/integration/kotlin/com/mongodb/kotlin/client/syncadapter/SyncFindIterable.kt b/driver-kotlin-sync/src/integration/kotlin/com/mongodb/kotlin/client/syncadapter/SyncFindIterable.kt index c52866f1243..f179f4ff6bc 100644 --- a/driver-kotlin-sync/src/integration/kotlin/com/mongodb/kotlin/client/syncadapter/SyncFindIterable.kt +++ b/driver-kotlin-sync/src/integration/kotlin/com/mongodb/kotlin/client/syncadapter/SyncFindIterable.kt @@ -25,7 +25,6 @@ import org.bson.BsonValue import org.bson.Document import org.bson.conversions.Bson -@Suppress("DEPRECATION") internal class SyncFindIterable(val wrapped: FindIterable) : JFindIterable, SyncMongoIterable(wrapped) { override fun batchSize(batchSize: Int): SyncFindIterable = apply { wrapped.batchSize(batchSize) } @@ -55,9 +54,6 @@ internal class SyncFindIterable(val wrapped: FindIterable) : wrapped.noCursorTimeout(noCursorTimeout) } - @Suppress("OVERRIDE_DEPRECATION") - override fun oplogReplay(oplogReplay: Boolean): SyncFindIterable = apply { wrapped.oplogReplay(oplogReplay) } - override fun partial(partial: Boolean): SyncFindIterable = apply { wrapped.partial(partial) } override fun cursorType(cursorType: CursorType): SyncFindIterable = apply { wrapped.cursorType(cursorType) } diff --git a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/FindIterable.kt b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/FindIterable.kt index 45b51a1e9c9..2a33cb6f268 100644 --- a/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/FindIterable.kt +++ b/driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/FindIterable.kt @@ -126,17 +126,6 @@ public class FindIterable(private val wrapped: JFindIterable) : Mong wrapped.noCursorTimeout(noCursorTimeout) } - /** - * Users should not set this under normal circumstances. - * - * @param oplogReplay if oplog replay is enabled - * @return this - * @deprecated oplogReplay has been deprecated in MongoDB 4.4. - */ - @Suppress("DEPRECATION") - @Deprecated("oplogReplay has been deprecated in MongoDB 4.4", replaceWith = ReplaceWith("")) - public fun oplogReplay(oplogReplay: Boolean): FindIterable = apply { wrapped.oplogReplay(oplogReplay) } - /** * Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error). * diff --git a/driver-kotlin-sync/src/test/kotlin/com/mongodb/kotlin/client/FindIterableTest.kt b/driver-kotlin-sync/src/test/kotlin/com/mongodb/kotlin/client/FindIterableTest.kt index c84176a0cbf..9d8d28104d1 100644 --- a/driver-kotlin-sync/src/test/kotlin/com/mongodb/kotlin/client/FindIterableTest.kt +++ b/driver-kotlin-sync/src/test/kotlin/com/mongodb/kotlin/client/FindIterableTest.kt @@ -26,12 +26,7 @@ import org.bson.BsonDocument import org.bson.BsonString import org.bson.Document import org.junit.jupiter.api.Test -import org.mockito.kotlin.doReturn -import org.mockito.kotlin.mock -import org.mockito.kotlin.times -import org.mockito.kotlin.verify -import org.mockito.kotlin.verifyNoMoreInteractions -import org.mockito.kotlin.whenever +import org.mockito.kotlin.* class FindIterableTest { @Test @@ -42,7 +37,6 @@ class FindIterableTest { assertEquals(jFindIterableFunctions, kFindIterableFunctions) } - @Suppress("DEPRECATION") @Test fun shouldCallTheUnderlyingMethods() { val wrapped: JFindIterable = mock() @@ -85,7 +79,6 @@ class FindIterableTest { iterable.maxTime(1) iterable.maxTime(1, TimeUnit.SECONDS) iterable.min(bson) - iterable.oplogReplay(true) iterable.noCursorTimeout(true) iterable.partial(true) iterable.projection(bson) @@ -114,7 +107,6 @@ class FindIterableTest { verify(wrapped).maxTime(1, TimeUnit.MILLISECONDS) verify(wrapped).maxTime(1, TimeUnit.SECONDS) verify(wrapped).min(bson) - verify(wrapped).oplogReplay(true) verify(wrapped).noCursorTimeout(true) verify(wrapped).partial(true) verify(wrapped).projection(bson) diff --git a/driver-legacy/src/main/com/mongodb/DBCursor.java b/driver-legacy/src/main/com/mongodb/DBCursor.java index 8012a1a8727..739901b7c57 100644 --- a/driver-legacy/src/main/com/mongodb/DBCursor.java +++ b/driver-legacy/src/main/com/mongodb/DBCursor.java @@ -387,20 +387,6 @@ public DBCursor cursorType(final CursorType cursorType) { return this; } - /** - * Users should not set this under normal circumstances. - * - * @param oplogReplay if oplog replay is enabled - * @return this - * @since 3.9 - * @deprecated oplogReplay has been deprecated in MongoDB 4.4. - */ - @Deprecated - public DBCursor oplogReplay(final boolean oplogReplay) { - findOptions.oplogReplay(oplogReplay); - return this; - } - /** * The server normally times out idle cursors after an inactivity period (10 minutes) * to prevent excess memory use. Set this option to prevent that. @@ -426,7 +412,6 @@ public DBCursor partial(final boolean partial) { return this; } - @SuppressWarnings("deprecation") private FindOperation getQueryOperation(final Decoder decoder) { return new FindOperation<>(collection.getNamespace(), decoder) @@ -449,7 +434,6 @@ private FindOperation getQueryOperation(final Decoder decode .max(collection.wrapAllowNull(findOptions.getMax())) .cursorType(findOptions.getCursorType()) .noCursorTimeout(findOptions.isNoCursorTimeout()) - .oplogReplay(findOptions.isOplogReplay()) .partial(findOptions.isPartial()) .returnKey(findOptions.isReturnKey()) .showRecordId(findOptions.isShowRecordId()) diff --git a/driver-legacy/src/main/com/mongodb/client/model/DBCollectionFindOptions.java b/driver-legacy/src/main/com/mongodb/client/model/DBCollectionFindOptions.java index 930843cc3ce..256419315f7 100644 --- a/driver-legacy/src/main/com/mongodb/client/model/DBCollectionFindOptions.java +++ b/driver-legacy/src/main/com/mongodb/client/model/DBCollectionFindOptions.java @@ -44,7 +44,6 @@ public final class DBCollectionFindOptions { private DBObject sort; private CursorType cursorType = CursorType.NonTailable; private boolean noCursorTimeout; - private boolean oplogReplay; private boolean partial; private ReadPreference readPreference; private ReadConcern readConcern; @@ -79,7 +78,6 @@ public DBCollectionFindOptions copy() { copiedOptions.sort(sort); copiedOptions.cursorType(cursorType); copiedOptions.noCursorTimeout(noCursorTimeout); - copiedOptions.oplogReplay(oplogReplay); copiedOptions.partial(partial); copiedOptions.readPreference(readPreference); copiedOptions.readConcern(readConcern); @@ -294,30 +292,6 @@ public DBCollectionFindOptions noCursorTimeout(final boolean noCursorTimeout) { return this; } - /** - * Users should not set this under normal circumstances. - * - * @return if oplog replay is enabled - * @deprecated oplogReplay has been deprecated in MongoDB 4.4. - */ - @Deprecated - public boolean isOplogReplay() { - return oplogReplay; - } - - /** - * Users should not set this under normal circumstances. - * - * @param oplogReplay if oplog replay is enabled - * @return this - * @deprecated oplogReplay has been deprecated in MongoDB 4.4. - */ - @Deprecated - public DBCollectionFindOptions oplogReplay(final boolean oplogReplay) { - this.oplogReplay = oplogReplay; - return this; - } - /** * Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error). * diff --git a/driver-legacy/src/test/unit/com/mongodb/DBCursorSpecification.groovy b/driver-legacy/src/test/unit/com/mongodb/DBCursorSpecification.groovy index 768dd52d7ed..84a755b5353 100644 --- a/driver-legacy/src/test/unit/com/mongodb/DBCursorSpecification.groovy +++ b/driver-legacy/src/test/unit/com/mongodb/DBCursorSpecification.groovy @@ -169,7 +169,6 @@ class DBCursorSpecification extends Specification { .limit(1) .maxTime(1, TimeUnit.MILLISECONDS) .noCursorTimeout(true) - .oplogReplay(true) .partial(true) .skip(1) .sort(sort) @@ -186,7 +185,6 @@ class DBCursorSpecification extends Specification { .limit(1) .maxTime(1, TimeUnit.MILLISECONDS) .noCursorTimeout(true) - .oplogReplay(true) .partial(true) .skip(1) .sort(bsonSort) @@ -226,7 +224,6 @@ class DBCursorSpecification extends Specification { .maxAwaitTime(1, TimeUnit.MILLISECONDS) .maxTime(1, TimeUnit.MILLISECONDS) .noCursorTimeout(true) - .oplogReplay(true) .partial(true) .projection(projection) .readConcern(readConcern) @@ -255,7 +252,6 @@ class DBCursorSpecification extends Specification { .maxAwaitTime(1, TimeUnit.MILLISECONDS) .maxTime(1, TimeUnit.MILLISECONDS) .noCursorTimeout(true) - .oplogReplay(true) .partial(true) .projection(bsonProjection) .skip(1) diff --git a/driver-legacy/src/test/unit/com/mongodb/client/model/DBCollectionFindOptionsSpecification.groovy b/driver-legacy/src/test/unit/com/mongodb/client/model/DBCollectionFindOptionsSpecification.groovy index 33e8e5af851..71127c6e9e3 100644 --- a/driver-legacy/src/test/unit/com/mongodb/client/model/DBCollectionFindOptionsSpecification.groovy +++ b/driver-legacy/src/test/unit/com/mongodb/client/model/DBCollectionFindOptionsSpecification.groovy @@ -32,7 +32,6 @@ class DBCollectionFindOptionsSpecification extends Specification { then: !options.isNoCursorTimeout() - !options.isOplogReplay() !options.isPartial() options.getBatchSize() == 0 options.getCollation() == null @@ -77,7 +76,6 @@ class DBCollectionFindOptionsSpecification extends Specification { .maxAwaitTime(1, TimeUnit.MILLISECONDS) .maxTime(1, TimeUnit.MILLISECONDS) .noCursorTimeout(true) - .oplogReplay(true) .partial(true) .projection(projection) .readConcern(readConcern) @@ -105,7 +103,6 @@ class DBCollectionFindOptionsSpecification extends Specification { options.getSkip() == 1 options.getSort() == sort options.isNoCursorTimeout() - options.isOplogReplay() options.isPartial() options.getComment() == comment options.getHint() == hint @@ -139,7 +136,6 @@ class DBCollectionFindOptionsSpecification extends Specification { .maxAwaitTime(1, TimeUnit.MILLISECONDS) .maxTime(1, TimeUnit.MILLISECONDS) .noCursorTimeout(true) - .oplogReplay(true) .partial(true) .projection(projection) .readConcern(readConcern) @@ -171,7 +167,6 @@ class DBCollectionFindOptionsSpecification extends Specification { options.getSkip() == 1 options.getSort() == sort options.isNoCursorTimeout() - options.isOplogReplay() options.isPartial() options.getComment() == comment options.getHint() == hint diff --git a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/FindPublisher.java b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/FindPublisher.java index d7ec41a1bfb..8a485facaf5 100644 --- a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/FindPublisher.java +++ b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/FindPublisher.java @@ -126,16 +126,6 @@ public interface FindPublisher extends Publisher { */ FindPublisher noCursorTimeout(boolean noCursorTimeout); - /** - * Users should not set this under normal circumstances. - * - * @param oplogReplay if oplog replay is enabled - * @return this - * @deprecated oplogReplay has been deprecated in MongoDB 4.4. - */ - @Deprecated - FindPublisher oplogReplay(boolean oplogReplay); - /** * Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error). * diff --git a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/FindPublisherImpl.java b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/FindPublisherImpl.java index f1b0f116f63..401c02dc583 100644 --- a/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/FindPublisherImpl.java +++ b/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/FindPublisherImpl.java @@ -110,13 +110,6 @@ public FindPublisher noCursorTimeout(final boolean noCursorTimeout) { return this; } - @Override - @Deprecated - public FindPublisher oplogReplay(final boolean oplogReplay) { - findOptions.oplogReplay(oplogReplay); - return this; - } - @Override public FindPublisher partial(final boolean partial) { findOptions.partial(partial); diff --git a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/syncadapter/SyncFindIterable.java b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/syncadapter/SyncFindIterable.java index ca218e50ada..0cc68b0042e 100644 --- a/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/syncadapter/SyncFindIterable.java +++ b/driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/syncadapter/SyncFindIterable.java @@ -89,13 +89,6 @@ public FindIterable noCursorTimeout(final boolean noCursorTimeout) { return this; } - @Override - @Deprecated - public FindIterable oplogReplay(final boolean oplogReplay) { - wrapped.oplogReplay(oplogReplay); - return this; - } - @Override public FindIterable partial(final boolean partial) { wrapped.partial(partial); diff --git a/driver-reactive-streams/src/test/unit/com/mongodb/reactivestreams/client/internal/FindPublisherImplTest.java b/driver-reactive-streams/src/test/unit/com/mongodb/reactivestreams/client/internal/FindPublisherImplTest.java index 0b297c13a87..62a7596a681 100644 --- a/driver-reactive-streams/src/test/unit/com/mongodb/reactivestreams/client/internal/FindPublisherImplTest.java +++ b/driver-reactive-streams/src/test/unit/com/mongodb/reactivestreams/client/internal/FindPublisherImplTest.java @@ -37,7 +37,6 @@ import static java.util.concurrent.TimeUnit.SECONDS; import static org.junit.jupiter.api.Assertions.assertEquals; -@SuppressWarnings("deprecation") public class FindPublisherImplTest extends TestHelper { private static final MongoNamespace NAMESPACE = new MongoNamespace("db", "coll"); @@ -73,7 +72,6 @@ void shouldBuildTheExpectedOperation() { .limit(100) .skip(10) .cursorType(CursorType.NonTailable) - .oplogReplay(false) .noCursorTimeout(false) .partial(false) .collation(COLLATION) diff --git a/driver-scala/src/integration/scala/org/mongodb/scala/syncadapter/SyncFindIterable.scala b/driver-scala/src/integration/scala/org/mongodb/scala/syncadapter/SyncFindIterable.scala index b9114a91ab2..e66f70913b6 100644 --- a/driver-scala/src/integration/scala/org/mongodb/scala/syncadapter/SyncFindIterable.scala +++ b/driver-scala/src/integration/scala/org/mongodb/scala/syncadapter/SyncFindIterable.scala @@ -69,11 +69,6 @@ case class SyncFindIterable[T](wrapped: FindObservable[T]) extends SyncMongoIter this } - override def oplogReplay(oplogReplay: Boolean): FindIterable[T] = { - wrapped.oplogReplay(oplogReplay) - this - } - override def partial(partial: Boolean): FindIterable[T] = { wrapped.partial(partial) this diff --git a/driver-scala/src/main/scala/org/mongodb/scala/FindObservable.scala b/driver-scala/src/main/scala/org/mongodb/scala/FindObservable.scala index 2d147a42211..575ca66e8c8 100644 --- a/driver-scala/src/main/scala/org/mongodb/scala/FindObservable.scala +++ b/driver-scala/src/main/scala/org/mongodb/scala/FindObservable.scala @@ -16,14 +16,14 @@ package org.mongodb.scala -import java.util.concurrent.TimeUnit -import com.mongodb.{ CursorType, ExplainVerbosity } import com.mongodb.reactivestreams.client.FindPublisher +import com.mongodb.{ CursorType, ExplainVerbosity } import org.mongodb.scala.bson.BsonValue import org.mongodb.scala.bson.DefaultHelper.DefaultsTo import org.mongodb.scala.bson.conversions.Bson import org.mongodb.scala.model.Collation +import java.util.concurrent.TimeUnit import scala.concurrent.duration.Duration import scala.reflect.ClassTag @@ -152,17 +152,6 @@ case class FindObservable[TResult](private val wrapped: FindPublisher[TResult]) this } - /** - * Users should not set this under normal circumstances. - * - * @param oplogReplay if oplog replay is enabled - * @return this - */ - def oplogReplay(oplogReplay: Boolean): FindObservable[TResult] = { - wrapped.oplogReplay(oplogReplay) - this - } - /** * Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error). * diff --git a/driver-scala/src/test/scala/org/mongodb/scala/FindObservableSpec.scala b/driver-scala/src/test/scala/org/mongodb/scala/FindObservableSpec.scala index d06053b96a2..1af77eeb6e7 100644 --- a/driver-scala/src/test/scala/org/mongodb/scala/FindObservableSpec.scala +++ b/driver-scala/src/test/scala/org/mongodb/scala/FindObservableSpec.scala @@ -16,14 +16,14 @@ package org.mongodb.scala -import java.util.concurrent.TimeUnit -import com.mongodb.{ CursorType, ExplainVerbosity } import com.mongodb.reactivestreams.client.FindPublisher +import com.mongodb.{ CursorType, ExplainVerbosity } import org.mockito.Mockito.{ verify, verifyNoMoreInteractions } import org.mongodb.scala.model.Collation import org.reactivestreams.Publisher import org.scalatestplus.mockito.MockitoSugar +import java.util.concurrent.TimeUnit import scala.concurrent.duration.Duration class FindObservableSpec extends BaseSpec with MockitoSugar { @@ -67,7 +67,6 @@ class FindObservableSpec extends BaseSpec with MockitoSugar { observable.maxAwaitTime(maxDuration) observable.maxTime(duration) observable.noCursorTimeout(true) - observable.oplogReplay(true) observable.partial(true) observable.projection(projection) observable.skip(1) @@ -86,7 +85,6 @@ class FindObservableSpec extends BaseSpec with MockitoSugar { verify(wrapper).maxAwaitTime(maxDuration.toMillis, TimeUnit.MILLISECONDS) verify(wrapper).maxTime(duration.toMillis, TimeUnit.MILLISECONDS) verify(wrapper).noCursorTimeout(true) - verify(wrapper).oplogReplay(true) verify(wrapper).partial(true) verify(wrapper).projection(projection) verify(wrapper).skip(1) diff --git a/driver-sync/src/main/com/mongodb/client/FindIterable.java b/driver-sync/src/main/com/mongodb/client/FindIterable.java index 3ea23c178c1..4cd3c7b7f43 100644 --- a/driver-sync/src/main/com/mongodb/client/FindIterable.java +++ b/driver-sync/src/main/com/mongodb/client/FindIterable.java @@ -119,16 +119,6 @@ public interface FindIterable extends MongoIterable { */ FindIterable noCursorTimeout(boolean noCursorTimeout); - /** - * Users should not set this under normal circumstances. - * - * @param oplogReplay if oplog replay is enabled - * @return this - * @deprecated oplogReplay has been deprecated in MongoDB 4.4. - */ - @Deprecated - FindIterable oplogReplay(boolean oplogReplay); - /** * Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error). * diff --git a/driver-sync/src/main/com/mongodb/client/internal/FindIterableImpl.java b/driver-sync/src/main/com/mongodb/client/internal/FindIterableImpl.java index b7b405d5a5a..de0fdc94f3e 100644 --- a/driver-sync/src/main/com/mongodb/client/internal/FindIterableImpl.java +++ b/driver-sync/src/main/com/mongodb/client/internal/FindIterableImpl.java @@ -128,13 +128,6 @@ public FindIterable noCursorTimeout(final boolean noCursorTimeout) { return this; } - @Override - @Deprecated - public FindIterable oplogReplay(final boolean oplogReplay) { - findOptions.oplogReplay(oplogReplay); - return this; - } - @Override public FindIterable partial(final boolean partial) { findOptions.partial(partial); diff --git a/driver-sync/src/test/unit/com/mongodb/client/internal/FindIterableSpecification.groovy b/driver-sync/src/test/unit/com/mongodb/client/internal/FindIterableSpecification.groovy index ebfe762cf90..98848a84dfa 100644 --- a/driver-sync/src/test/unit/com/mongodb/client/internal/FindIterableSpecification.groovy +++ b/driver-sync/src/test/unit/com/mongodb/client/internal/FindIterableSpecification.groovy @@ -68,7 +68,6 @@ class FindIterableSpecification extends Specification { .limit(100) .skip(10) .cursorType(CursorType.NonTailable) - .oplogReplay(false) .noCursorTimeout(false) .partial(false) .collation(null) @@ -118,7 +117,6 @@ class FindIterableSpecification extends Specification { .limit(99) .skip(9) .cursorType(CursorType.Tailable) - .oplogReplay(true) .noCursorTimeout(true) .partial(true) .collation(collation) @@ -144,7 +142,6 @@ class FindIterableSpecification extends Specification { .limit(99) .skip(9) .cursorType(CursorType.Tailable) - .oplogReplay(true) .noCursorTimeout(true) .partial(true) .collation(collation)