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 ea0f25b3b..ea5212c3e 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
@@ -1236,7 +1236,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
*/
@@ -3324,6 +3324,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
case PARTIAL:
cursorToUse = cursorToUse.partial(true);
break;
+ case SECONDARY_READS:
case SLAVE_OK:
break;
default:
@@ -3341,7 +3342,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 4337e68a4..1906fb808 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
@@ -2650,7 +2650,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
*/
@@ -3252,7 +3252,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 62a639799..d65ff6da2 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
@@ -63,7 +63,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;
@@ -173,7 +173,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 3bff1fb6b..fa5d3c474 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
@@ -300,9 +300,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 b797798b2..62b5eff5b 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
@@ -439,18 +439,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 549494b03..6ade70f76 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
@@ -1208,7 +1208,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)
@@ -1219,9 +1219,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 0a52b1180..8695dccdf 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
@@ -1656,32 +1656,32 @@ public class MongoTemplateUnitTests extends MongoOperationsUnitTests {
Assertions.assertThat(ReflectionTestUtils.getField(template, "entityCallbacks")).isSameAs(callbacks);
}
- @Test // DATAMONGO-2344
- public void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFind() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ public 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
- public void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindOne() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ public 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
- public void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindDistinct() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ public 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
- public void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForStream() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ public void allowSecondaryReadsQueryOptionShouldApplyPrimaryPreferredReadPreferenceForStream() {
template.stream(new Query().slaveOk(), 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 e542c6cd3..12b6b3919 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
@@ -821,26 +821,26 @@ public class ReactiveMongoTemplateUnitTests {
Assertions.assertThat(ReflectionTestUtils.getField(template, "entityCallbacks")).isSameAs(callbacks);
}
- @Test // DATAMONGO-2344
- public void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFind() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ public 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
- public void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindOne() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ public 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
- public void slaveOkQueryOptionShouldApplyPrimaryPreferredReadPreferenceForFindDistinct() {
+ @Test // DATAMONGO-2344, DATAMONGO-2572
+ public 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 bfe80bde0..7d9ca4ce7 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 @@ public class QueryTests {
.isNotEqualTo(source.getFieldsObject());
}
- @Test // DATAMONGO-1783
+ @Test // DATAMONGO-1783, DATAMONGO-2572
public 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 ba2dd25cf..18287fe23 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
@@ -213,7 +213,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");
@@ -221,7 +221,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
@@ -298,7 +298,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