Closed
Description
Simplified document:
@Document
public class Entity {
...
private List<EmailToken> tokenList = new LinkedList<>();
public static class EmailToken {
private String token;
private String type;
...
Saved through Repository the JSON looks like the following:
{
...
"tokenList": [
{
"token": "G1LTUPAPVQ1JGGE",
"type": "Type 1"
}
]
...
}
I wanted to try transaction stuff and tried to save the same object through the code suggested in docs:
Transaction Support
CouchbaseDocument entityDoc = new CouchbaseDocument(entity.getId());
mappingCouchbaseConverter.write(entity, entityDoc);
ctx.insert(
couchbaseClientFactory.withScope("some scope").getCollection("someColl"),
entityDoc.getId()(),
entityDoc.getContent());
The result looks like the following:
{
...
"tokenList": {
"empty": false
}
...
}
tokenList becomes a Map instead of a List with data loss.