DATACOUCH-560 - Serialization of CouchbaseDocument and CouchbaseList.

Add support for saving document with lists and composed objects.
Convert CouchbaseDocument/CouchbaseList to Map/List before saving.
This commit is contained in:
Andrea Torlaschi
2020-06-09 01:19:04 +02:00
committed by mikereiche
parent dddee9fb82
commit c7f12a2237
6 changed files with 123 additions and 3 deletions

View File

@@ -68,7 +68,7 @@ public class ReactiveInsertByIdOperationSupport implements ReactiveInsertByIdOpe
return Mono.just(object).flatMap(o -> {
CouchbaseDocument converted = template.support().encodeEntity(o);
return template.getCollection(collection).reactive()
.insert(converted.getId(), converted.getContent(), buildInsertOptions()).map(result -> {
.insert(converted.getId(), converted.export(), buildInsertOptions()).map(result -> {
template.support().applyUpdatedCas(object, result.cas());
return o;
});

View File

@@ -68,7 +68,7 @@ public class ReactiveReplaceByIdOperationSupport implements ReactiveReplaceByIdO
return Mono.just(object).flatMap(o -> {
CouchbaseDocument converted = template.support().encodeEntity(o);
return template.getCollection(collection).reactive()
.replace(converted.getId(), converted.getContent(), buildReplaceOptions()).map(result -> {
.replace(converted.getId(), converted.export(), buildReplaceOptions()).map(result -> {
template.support().applyUpdatedCas(object, result.cas());
return o;
});

View File

@@ -68,7 +68,7 @@ public class ReactiveUpsertByIdOperationSupport implements ReactiveUpsertByIdOpe
return Mono.just(object).flatMap(o -> {
CouchbaseDocument converted = template.support().encodeEntity(o);
return template.getCollection(collection).reactive()
.upsert(converted.getId(), converted.getContent(), buildUpsertOptions()).map(result -> {
.upsert(converted.getId(), converted.export(), buildUpsertOptions()).map(result -> {
template.support().applyUpdatedCas(object, result.cas());
return o;
});