spring-data-couchbase icon indicating copy to clipboard operation
spring-data-couchbase copied to clipboard

Support PersistTo, ReplicateTo and DurabilityLevel attributes on Document annotation.

Open jorgerod opened this issue 2 years ago • 3 comments

Hello

In some operationSupport, the values of PersistTo, ReplicateTo or DurabilityLevel are not configurable and the value NONE is always being used.

https://github.com/spring-projects/spring-data-couchbase/blob/34f96018350cb1d1d556d56981df738749bf59a7/src/main/java/org/springframework/data/couchbase/core/ReactiveReplaceByIdOperationSupport.java#L45-L50

https://github.com/spring-projects/spring-data-couchbase/blob/62feffa89d2264e1fdfdb9913703f4f106a7d60b/src/main/java/org/springframework/data/couchbase/core/ReactiveRemoveByIdOperationSupport.java#L49-L54

Is there any plan to support these values?

Thank you very much in advance

jorgerod avatar Jun 28 '22 14:06 jorgerod

All the options are set with the fluent APIs. Just look a little further down that class at the two withDurability() methods.

https://github.com/spring-projects/spring-data-couchbase/blob/34f96018350cb1d1d556d56981df738749bf59a7/src/main/java/org/springframework/data/couchbase/core/ReactiveReplaceByIdOperationSupport.java#L129

https://github.com/spring-projects/spring-data-couchbase/blob/34f96018350cb1d1d556d56981df738749bf59a7/src/main/java/org/springframework/data/couchbase/core/ReactiveReplaceByIdOperationSupport.java#L136

mikereiche avatar Jun 28 '22 21:06 mikereiche

Hi @mikereiche Thank you very much for your quick response.

To use the fluent methods you mentioned, I would have to define the methods myself in my own repository (which is the approach I am taking).

My question/suggestion is that if SimpleReactiveCouchbaseRepository could take into account replicationPolicies by document type in methods like save, deleteById or delete and consequently ReactiveCouchbaseTemplate also take into account those values and use the fluent methods like withDurability you have commented.

This way, it would be transparent to the developer.

Thank you

jorgerod avatar Jun 29 '22 10:06 jorgerod

could take into account replicationPolicies by document type

So you're asking to add an attribute to the @Document annotation. (like Expiry). We can do that.

mikereiche avatar Jul 13 '22 00:07 mikereiche