Skip to content

Update javadoc & switch method defaulting. #5015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>5.0.0-SNAPSHOT</version>
<version>5.0.x-GH-5010-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Spring Data MongoDB</name>
Expand Down
2 changes: 1 addition & 1 deletion spring-data-mongodb-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>5.0.0-SNAPSHOT</version>
<version>5.0.x-GH-5010-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion spring-data-mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>5.0.0-SNAPSHOT</version>
<version>5.0.x-GH-5010-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public DefaultIndexOperations(MongoOperations mongoOperations, String collection

@Override
@SuppressWarnings("NullAway")
public String ensureIndex(IndexDefinition indexDefinition) {
public String createIndex(IndexDefinition indexDefinition) {

return execute(collection -> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public DefaultReactiveIndexOperations(ReactiveMongoOperations mongoOperations, S

@Override
@SuppressWarnings("NullAway")
public Mono<String> ensureIndex(IndexDefinition indexDefinition) {
public Mono<String> createIndex(IndexDefinition indexDefinition) {

return mongoOperations.execute(collectionName, collection -> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,20 @@ public interface IndexOperations {
* @deprecated since 4.5, in favor of {@link #createIndex(IndexDefinition)}.
*/
@Deprecated(since = "4.5", forRemoval = true)
String ensureIndex(IndexDefinition indexDefinition);
default String ensureIndex(IndexDefinition indexDefinition) {
return createIndex(indexDefinition);
}

/**
* Create the index for the provided {@link IndexDefinition} exists for the collection indicated by the entity class.
* If not it will be created.
* Create the index for the provided {@link IndexDefinition} for the collection indicated by the entity class. If the
* index does not exist it will be created. Might error if the collection already defines an index with the same name
* but different settings.
*
* @param indexDefinition must not be {@literal null}.
* @return the index name.
* @since 4.5
*/
default String createIndex(IndexDefinition indexDefinition) {
return ensureIndex(indexDefinition);
}
String createIndex(IndexDefinition indexDefinition);

/**
* Alters the index with given {@literal name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ static IndexOperationsAdapter blocking(ReactiveIndexOperations reactiveIndexOper
return new IndexOperationsAdapter() {

@Override
public String ensureIndex(IndexDefinition indexDefinition) {
return reactiveIndexOperations.ensureIndex(indexDefinition).block();
public String createIndex(IndexDefinition indexDefinition) {
return reactiveIndexOperations.createIndex(indexDefinition).block();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,20 @@ public interface ReactiveIndexOperations {
* @deprecated since 4.5, in favor of {@link #createIndex(IndexDefinition)}.
*/
@Deprecated(since = "4.5", forRemoval = true)
Mono<String> ensureIndex(IndexDefinition indexDefinition);
default Mono<String> ensureIndex(IndexDefinition indexDefinition) {
return createIndex(indexDefinition);
}

/**
* Create the index for the provided {@link IndexDefinition} exists for the collection indicated by the entity class.
* If not it will be created.
* Create the index for the provided {@link IndexDefinition} for the collection indicated by the entity class. If the
* index does not exist it will be created. Might error if the collection already defines an index with the same name
* but different settings.
*
* @param indexDefinition must not be {@literal null}.
* @return the index name.
* @since 4.5
*/
default Mono<String> createIndex(IndexDefinition indexDefinition) {
return ensureIndex(indexDefinition);
}
Mono<String> createIndex(IndexDefinition indexDefinition);

/**
* Alters the index with given {@literal name}.
Expand Down