@@ -71,10 +71,10 @@ static class ReactiveInsertByIdSupport<T> implements ReactiveInsertById<T> {
71
71
public Mono <T > one (T object ) {
72
72
return Mono .just (object ).flatMap (o -> {
73
73
CouchbaseDocument converted = template .support ().encodeEntity (o );
74
+ Object updatedObject = template .support ().applyUpdatedId (o , converted .getId ());
74
75
return template .getCollection (collection ).reactive ()
75
76
.insert (converted .getId (), converted .export (), buildInsertOptions ()).map (result -> {
76
- template .support ().applyUpdatedCas (object , result .cas ());
77
- return o ;
77
+ return (T ) template .support ().applyUpdatedCas (updatedObject , result .cas ());
78
78
});
79
79
}).onErrorMap (throwable -> {
80
80
if (throwable instanceof RuntimeException ) {
@@ -97,7 +97,7 @@ private InsertOptions buildInsertOptions() {
97
97
} else if (durabilityLevel != DurabilityLevel .NONE ) {
98
98
options .durability (durabilityLevel );
99
99
}
100
- if (expiry != null && ! expiry .isZero ()) {
100
+ if (expiry != null && !expiry .isZero ()) {
101
101
options .expiry (expiry );
102
102
} else if (domainType .isAnnotationPresent (Document .class )) {
103
103
Document documentAnn = domainType .getAnnotation (Document .class );
@@ -110,26 +110,30 @@ private InsertOptions buildInsertOptions() {
110
110
@ Override
111
111
public TerminatingInsertById <T > inCollection (final String collection ) {
112
112
Assert .hasText (collection , "Collection must not be null nor empty." );
113
- return new ReactiveInsertByIdSupport <>(template , domainType , collection , persistTo , replicateTo , durabilityLevel , expiry );
113
+ return new ReactiveInsertByIdSupport <>(template , domainType , collection , persistTo , replicateTo , durabilityLevel ,
114
+ expiry );
114
115
}
115
116
116
117
@ Override
117
118
public InsertByIdWithCollection <T > withDurability (final DurabilityLevel durabilityLevel ) {
118
119
Assert .notNull (durabilityLevel , "Durability Level must not be null." );
119
- return new ReactiveInsertByIdSupport <>(template , domainType , collection , persistTo , replicateTo , durabilityLevel , expiry );
120
+ return new ReactiveInsertByIdSupport <>(template , domainType , collection , persistTo , replicateTo , durabilityLevel ,
121
+ expiry );
120
122
}
121
123
122
124
@ Override
123
125
public InsertByIdWithCollection <T > withDurability (final PersistTo persistTo , final ReplicateTo replicateTo ) {
124
126
Assert .notNull (persistTo , "PersistTo must not be null." );
125
127
Assert .notNull (replicateTo , "ReplicateTo must not be null." );
126
- return new ReactiveInsertByIdSupport <>(template , domainType , collection , persistTo , replicateTo , durabilityLevel , expiry );
128
+ return new ReactiveInsertByIdSupport <>(template , domainType , collection , persistTo , replicateTo , durabilityLevel ,
129
+ expiry );
127
130
}
128
131
129
132
@ Override
130
133
public InsertByIdWithDurability <T > withExpiry (final Duration expiry ) {
131
134
Assert .notNull (expiry , "expiry must not be null." );
132
- return new ReactiveInsertByIdSupport <>(template , domainType , collection , persistTo , replicateTo , durabilityLevel , expiry );
135
+ return new ReactiveInsertByIdSupport <>(template , domainType , collection , persistTo , replicateTo , durabilityLevel ,
136
+ expiry );
133
137
}
134
138
}
135
139
0 commit comments