diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java
index b70ddcbb6..4102fd346 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java
@@ -1178,7 +1178,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
/**
* Prepare the collection before any processing is done using it. This allows a convenient way to apply settings like
- * slaveOk() etc. Can be overridden in sub-classes.
+ * withCodecRegistry() etc. Can be overridden in sub-classes.
*
* @param collection
*/
@@ -3260,6 +3260,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
case PARTIAL:
cursorToUse = cursorToUse.partial(true);
break;
+ case SECONDARY_READS:
case SLAVE_OK:
break;
default:
@@ -3277,7 +3278,8 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
@Override
public ReadPreference getReadPreference() {
- return query.getMeta().getFlags().contains(CursorOption.SLAVE_OK) ? ReadPreference.primaryPreferred() : null;
+ return (query.getMeta().getFlags().contains(CursorOption.SECONDARY_READS)
+ || query.getMeta().getFlags().contains(CursorOption.SLAVE_OK)) ? ReadPreference.primaryPreferred() : null;
}
}
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java
index 9bfcc533f..170d80638 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java
@@ -2682,7 +2682,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
/**
* Prepare the collection before any processing is done using it. This allows a convenient way to apply settings like
- * slaveOk() etc. Can be overridden in sub-classes.
+ * withCodecRegistry() etc. Can be overridden in sub-classes.
*
* @param collection
*/
@@ -3295,7 +3295,8 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@Override
public ReadPreference getReadPreference() {
- return query.getMeta().getFlags().contains(CursorOption.SLAVE_OK) ? ReadPreference.primaryPreferred() : null;
+ return (query.getMeta().getFlags().contains(CursorOption.SECONDARY_READS)
+ || query.getMeta().getFlags().contains(CursorOption.SLAVE_OK)) ? ReadPreference.primaryPreferred() : null;
}
}
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/PrefixingDelegatingAggregationOperationContext.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/PrefixingDelegatingAggregationOperationContext.java
index b941b801a..a9d384e10 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/PrefixingDelegatingAggregationOperationContext.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/PrefixingDelegatingAggregationOperationContext.java
@@ -31,7 +31,7 @@ import org.springframework.lang.Nullable;
* {@link AggregationOperationContext} implementation prefixing non-command keys on root level with the given prefix.
* Useful when mapping fields to domain specific types while having to prefix keys for query purpose.
*
- * Fields to be excluded from prefixing my be added to a {@literal blacklist}.
+ * Fields to be excluded from prefixing my be added to a {@literal denylist}.
*
* @author Christoph Strobl
* @author Mark Paluch
@@ -41,18 +41,18 @@ public class PrefixingDelegatingAggregationOperationContext implements Aggregati
private final AggregationOperationContext delegate;
private final String prefix;
- private final Set blacklist;
+ private final Set denylist;
public PrefixingDelegatingAggregationOperationContext(AggregationOperationContext delegate, String prefix) {
this(delegate, prefix, Collections.emptySet());
}
public PrefixingDelegatingAggregationOperationContext(AggregationOperationContext delegate, String prefix,
- Collection blacklist) {
+ Collection denylist) {
this.delegate = delegate;
this.prefix = prefix;
- this.blacklist = new HashSet<>(blacklist);
+ this.denylist = new HashSet<>(denylist);
}
/*
@@ -121,7 +121,7 @@ public class PrefixingDelegatingAggregationOperationContext implements Aggregati
}
private String prefixKey(String key) {
- return (key.startsWith("$") || isBlacklisted(key)) ? key : (prefix + "." + key);
+ return (key.startsWith("$") || isDenied(key)) ? key : (prefix + "." + key);
}
private Object prefixCollection(Collection sourceCollection) {
@@ -139,9 +139,9 @@ public class PrefixingDelegatingAggregationOperationContext implements Aggregati
return prefixed;
}
- private boolean isBlacklisted(String key) {
+ private boolean isDenied(String key) {
- if (blacklist.contains(key)) {
+ if (denylist.contains(key)) {
return true;
}
@@ -149,8 +149,8 @@ public class PrefixingDelegatingAggregationOperationContext implements Aggregati
return false;
}
- for (String blacklisted : blacklist) {
- if (key.startsWith(blacklisted + ".")) {
+ for (String denied : denylist) {
+ if (key.startsWith(denied + ".")) {
return true;
}
}
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/ChangeStreamTask.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/ChangeStreamTask.java
index 81b67c210..7ae6b2af0 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/ChangeStreamTask.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/ChangeStreamTask.java
@@ -64,7 +64,7 @@ import com.mongodb.client.model.changestream.FullDocument;
*/
class ChangeStreamTask extends CursorReadingTask, Object> {
- private final Set blacklist = new HashSet<>(
+ private final Set denylist = new HashSet<>(
Arrays.asList("operationType", "fullDocument", "documentKey", "updateDescription", "ns"));
private final QueryMapper queryMapper;
@@ -178,7 +178,7 @@ class ChangeStreamTask extends CursorReadingTask,
template.getConverter().getMappingContext(), queryMapper)
: Aggregation.DEFAULT_CONTEXT;
- return agg.toPipeline(new PrefixingDelegatingAggregationOperationContext(context, "fullDocument", blacklist));
+ return agg.toPipeline(new PrefixingDelegatingAggregationOperationContext(context, "fullDocument", denylist));
}
if (filter instanceof List) {
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Meta.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Meta.java
index a32435c5d..c865fef80 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Meta.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Meta.java
@@ -284,9 +284,21 @@ public class Meta {
*/
EXHAUST,
- /** Allows querying of a replica slave. */
+ /**
+ * Allows querying of a replica.
+ *
+ * @deprecated since 3.0.2, use {@link #SECONDARY_READS} instead.
+ */
+ @Deprecated
SLAVE_OK,
+ /**
+ * Allows querying of a replica.
+ *
+ * @since 3.0.2
+ */
+ SECONDARY_READS,
+
/**
* Sets the cursor to return partial data from a query against a sharded cluster in which some shards do not respond
* rather than throwing an error.
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java
index 291af0c65..ec63ac504 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java
@@ -411,18 +411,33 @@ public class Query {
}
/**
- * Allows querying of a replica slave.
+ * Allows querying of a replica.
*
* @return this.
* @see org.springframework.data.mongodb.core.query.Meta.CursorOption#SLAVE_OK
* @since 1.10
+ * @deprecated since 3.0.2, use {@link #allowSecondaryReads()}.
*/
+ @Deprecated
public Query slaveOk() {
meta.addFlag(Meta.CursorOption.SLAVE_OK);
return this;
}
+ /**
+ * Allows querying of a replica.
+ *
+ * @return this.
+ * @see org.springframework.data.mongodb.core.query.Meta.CursorOption#SECONDARY_READS
+ * @since 3.0.2
+ */
+ public Query allowSecondaryReads() {
+
+ meta.addFlag(Meta.CursorOption.SECONDARY_READS);
+ return this;
+ }
+
/**
* @return this.
* @see org.springframework.data.mongodb.core.query.Meta.CursorOption#PARTIAL
diff --git a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.0.xsd b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.0.xsd
index 2b4fbee2b..a179fdb9f 100644
--- a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.0.xsd
+++ b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.0.xsd
@@ -434,7 +434,7 @@ This controls whether or not to fsync. The 'fsync' option to the getlasterror c
diff --git a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.1.xsd b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.1.xsd
index cd81bf328..5c959b812 100644
--- a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.1.xsd
+++ b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.1.xsd
@@ -432,7 +432,7 @@ This controls whether or not to fsync. The 'fsync' option to the getlasterror c
diff --git a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.10.2.xsd b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.10.2.xsd
index 1d4a09be1..6c0fcc67c 100644
--- a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.10.2.xsd
+++ b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.10.2.xsd
@@ -531,7 +531,7 @@ This controls whether or not to fsync. The 'fsync' option to the getlasterror c
diff --git a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.10.xsd b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.10.xsd
index 5d06b0a49..dde5cd0a9 100644
--- a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.10.xsd
+++ b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.10.xsd
@@ -531,7 +531,7 @@ This controls whether or not to fsync. The 'fsync' option to the getlasterror c
diff --git a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.2.xsd b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.2.xsd
index 71dbf8709..f73f940c7 100644
--- a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.2.xsd
+++ b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.2.xsd
@@ -447,7 +447,7 @@ This controls whether or not to fsync. The 'fsync' option to the getlasterror c
diff --git a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.3.xsd b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.3.xsd
index 2aa09c0cd..c9d1b0a25 100644
--- a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.3.xsd
+++ b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.3.xsd
@@ -462,7 +462,7 @@ This controls whether or not to fsync. The 'fsync' option to the getlasterror c
diff --git a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.4.xsd b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.4.xsd
index 33874b3f2..541661c8c 100644
--- a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.4.xsd
+++ b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.4.xsd
@@ -480,7 +480,7 @@ This controls whether or not to fsync. The 'fsync' option to the getlasterror c
diff --git a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.5.xsd b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.5.xsd
index 43ba06bae..1363480b5 100644
--- a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.5.xsd
+++ b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.5.xsd
@@ -498,7 +498,7 @@ This controls whether or not to fsync. The 'fsync' option to the getlasterror c
diff --git a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.7.xsd b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.7.xsd
index ecb082e81..51ff5b3a1 100644
--- a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.7.xsd
+++ b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.7.xsd
@@ -531,7 +531,7 @@ This controls whether or not to fsync. The 'fsync' option to the getlasterror c
diff --git a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.8.xsd b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.8.xsd
index cb02bb191..40d6de36d 100644
--- a/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.8.xsd
+++ b/spring-data-mongodb/src/main/resources/org/springframework/data/mongodb/config/spring-mongo-1.8.xsd
@@ -537,7 +537,7 @@ This controls whether or not to fsync. The 'fsync' option to the getlasterror c
diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java
index e7027a05a..f7c308a2f 100644
--- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java
+++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java
@@ -1162,7 +1162,7 @@ public class MongoTemplateTests {
assertThat(p5.getFirstName()).isEqualTo("Mark");
}
- @Test
+ @Test // DATAMONGO-2572
public void testUsingReadPreference() throws Exception {
this.template.execute("readPref", new CollectionCallback() {
public Object doInCollection(MongoCollection collection)
@@ -1173,9 +1173,9 @@ public class MongoTemplateTests {
return null;
}
});
- MongoTemplate slaveTemplate = new MongoTemplate(factory);
- slaveTemplate.setReadPreference(ReadPreference.secondary());
- slaveTemplate.execute("readPref", new CollectionCallback() {
+ MongoTemplate secondaryTemplate = new MongoTemplate(factory);
+ secondaryTemplate.setReadPreference(ReadPreference.secondary());
+ secondaryTemplate.execute("readPref", new CollectionCallback() {
public Object doInCollection(MongoCollection collection)
throws MongoException, DataAccessException {
assertThat(collection.getReadPreference()).isEqualTo(ReadPreference.secondary());
diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateUnitTests.java
index da6a16c6a..28f374d2b 100644
--- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateUnitTests.java
+++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateUnitTests.java
@@ -1714,34 +1714,34 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
Assertions.assertThat(ReflectionTestUtils.getField(template, "entityCallbacks")).isSameAs(callbacks);
}
- @Test // DATAMONGO-2344
- void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFind() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ void allowSecondaryReadsQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFind() {
- template.find(new Query().slaveOk(), AutogenerateableId.class);
+ template.find(new Query().allowSecondaryReads(), AutogenerateableId.class);
verify(collection).withReadPreference(eq(ReadPreference.primaryPreferred()));
}
- @Test // DATAMONGO-2344
- void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindOne() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ void allowSecondaryReadsQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindOne() {
- template.findOne(new Query().slaveOk(), AutogenerateableId.class);
+ template.findOne(new Query().allowSecondaryReads(), AutogenerateableId.class);
verify(collection).withReadPreference(eq(ReadPreference.primaryPreferred()));
}
- @Test // DATAMONGO-2344
- void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindDistinct() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ void allowSecondaryReadsQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindDistinct() {
- template.findDistinct(new Query().slaveOk(), "name", AutogenerateableId.class, String.class);
+ template.findDistinct(new Query().allowSecondaryReads(), "name", AutogenerateableId.class, String.class);
verify(collection).withReadPreference(eq(ReadPreference.primaryPreferred()));
}
- @Test // DATAMONGO-2344
- void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForStream() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ void allowSecondaryReadsQueryOptionShouldApplyPrimaryPreferredReadPreferenceForStream() {
- template.stream(new Query().slaveOk(), AutogenerateableId.class);
+ template.stream(new Query().allowSecondaryReads(), AutogenerateableId.class);
verify(collection).withReadPreference(eq(ReadPreference.primaryPreferred()));
}
diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ReactiveMongoTemplateUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ReactiveMongoTemplateUnitTests.java
index 1dac146e1..46073a895 100644
--- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ReactiveMongoTemplateUnitTests.java
+++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ReactiveMongoTemplateUnitTests.java
@@ -896,26 +896,26 @@ public class ReactiveMongoTemplateUnitTests {
Assertions.assertThat(ReflectionTestUtils.getField(template, "entityCallbacks")).isSameAs(callbacks);
}
- @Test // DATAMONGO-2344
- void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFind() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ void allowSecondaryReadsQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFind() {
- template.find(new Query().slaveOk(), AutogenerateableId.class).subscribe();
+ template.find(new Query().allowSecondaryReads(), AutogenerateableId.class).subscribe();
verify(collection).withReadPreference(eq(ReadPreference.primaryPreferred()));
}
- @Test // DATAMONGO-2344
- void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindOne() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ void allowSecondaryReadsQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindOne() {
- template.findOne(new Query().slaveOk(), AutogenerateableId.class).subscribe();
+ template.findOne(new Query().allowSecondaryReads(), AutogenerateableId.class).subscribe();
verify(collection).withReadPreference(eq(ReadPreference.primaryPreferred()));
}
- @Test // DATAMONGO-2344
- void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindDistinct() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ void allowSecondaryReadsQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindDistinct() {
- template.findDistinct(new Query().slaveOk(), "name", AutogenerateableId.class, String.class).subscribe();
+ template.findDistinct(new Query().allowSecondaryReads(), "name", AutogenerateableId.class, String.class).subscribe();
verify(collection).withReadPreference(eq(ReadPreference.primaryPreferred()));
}
diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/QueryTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/QueryTests.java
index 6e4b92086..1c1ff8c71 100644
--- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/QueryTests.java
+++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/QueryTests.java
@@ -297,14 +297,14 @@ class QueryTests {
.isNotEqualTo(source.getFieldsObject());
}
- @Test // DATAMONGO-1783
+ @Test // DATAMONGO-1783, DATAMONGO-2572
void clonedQueryShouldNotDependOnMetaFromSource() {
Query source = new Query().maxTimeMsec(100);
Query target = Query.of(source);
compareQueries(target, source);
- source.slaveOk();
+ source.allowSecondaryReads();
Meta meta = new Meta();
meta.setMaxTimeMsec(100);
diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java
index e4d5c8475..18c701306 100644
--- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java
+++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java
@@ -194,7 +194,7 @@ public class MongoQueryMethodUnitTests {
.contains(org.springframework.data.mongodb.core.query.Meta.CursorOption.NO_TIMEOUT);
}
- @Test // DATAMONGO-1480
+ @Test // DATAMONGO-1480, DATAMONGO-2572
public void createsMongoQueryMethodWithMultipleFlagsCorrectly() throws Exception {
MongoQueryMethod method = queryMethod(PersonRepository.class, "metaWithMultipleFlags");
@@ -202,7 +202,7 @@ public class MongoQueryMethodUnitTests {
assertThat(method.hasQueryMetaAttributes()).isTrue();
assertThat(method.getQueryMetaAttributes().getFlags()).contains(
org.springframework.data.mongodb.core.query.Meta.CursorOption.NO_TIMEOUT,
- org.springframework.data.mongodb.core.query.Meta.CursorOption.SLAVE_OK);
+ org.springframework.data.mongodb.core.query.Meta.CursorOption.SECONDARY_READS);
}
@Test // DATAMONGO-1266
@@ -273,7 +273,7 @@ public class MongoQueryMethodUnitTests {
List metaWithNoCursorTimeout();
@Meta(flags = { org.springframework.data.mongodb.core.query.Meta.CursorOption.NO_TIMEOUT,
- org.springframework.data.mongodb.core.query.Meta.CursorOption.SLAVE_OK })
+ org.springframework.data.mongodb.core.query.Meta.CursorOption.SECONDARY_READS })
List metaWithMultipleFlags();
// DATAMONGO-1266