Skip to content

Commit 501a1cc

Browse files
mp911dechristophstrobl
authored andcommitted
Polishing.
Consistently use Document instead of record. Reformat code. Tweak documentation wording. See: #4462
1 parent 49ff6f1 commit 501a1cc

File tree

5 files changed

+106
-105
lines changed

5 files changed

+106
-105
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableUpdateOperation.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ default Optional<T> findAndModify() {
8989

9090
/**
9191
* Trigger <a href="https://docs.mongodb.com/manual/reference/method/db.collection.replaceOne/">replaceOne</a>
92-
* execution by calling one of the terminating methods./** Trigger replace execution by calling one of the terminating
93-
* methods.
92+
* execution by calling one of the terminating methods.
9493
*
9594
* @author Christoph Strobl
9695
* @since 4.2
@@ -99,7 +98,7 @@ interface TerminatingReplace {
9998

10099
/**
101100
* Find first and replace/upsert.
102-
*
101+
*
103102
* @return never {@literal null}.
104103
*/
105104
UpdateResult replaceFirst();

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableUpdateOperationSupport.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public FindAndReplaceWithProjection<T> withOptions(FindAndReplaceOptions options
130130
public TerminatingReplace withOptions(ReplaceOptions options) {
131131

132132
FindAndReplaceOptions target = new FindAndReplaceOptions();
133-
if(options.isUpsert()) {
133+
if (options.isUpsert()) {
134134
target.upsert();
135135
}
136136
return new ExecutableUpdateSupport<>(template, domainType, query, update, collection, findAndModifyOptions,
@@ -188,11 +188,13 @@ public UpdateResult upsert() {
188188

189189
@Override
190190
public UpdateResult replaceFirst() {
191-
if(replacement != null) {
192-
return template.replace(query, domainType, replacement, findAndReplaceOptions != null ? findAndReplaceOptions : ReplaceOptions.none(), getCollectionName());
191+
if (replacement != null) {
192+
return template.replace(query, domainType, replacement,
193+
findAndReplaceOptions != null ? findAndReplaceOptions : ReplaceOptions.none(), getCollectionName());
193194
}
194195

195-
return template.replace(query, domainType, update, findAndReplaceOptions != null ? findAndReplaceOptions : ReplaceOptions.none(), getCollectionName());
196+
return template.replace(query, domainType, update,
197+
findAndReplaceOptions != null ? findAndReplaceOptions : ReplaceOptions.none(), getCollectionName());
196198
}
197199

198200
private UpdateResult doUpdate(boolean multi, boolean upsert) {

0 commit comments

Comments
 (0)