Hi Team,
I have enabled audit.log and observed the below two scenarios .
**Case 1 : Update using sub document API**
public static void updateUsingSubDocApi() {
String empDocumentId = "sample_1";
Duration duration = Duration.ofDays(2);
List<MutateInSpec> specs = new ArrayList<>();
specs.add(MutateInSpec.replace("name", "update_2_name"));
MutationResult mutateInResult = bucket.defaultCollection().mutateIn(empDocumentId, specs,
MutateInOptions.mutateInOptions().expiry(duration));
System.out.println(" data : " + mutateInResult);
}
**case 2: Update Using Replace option**
public static void update() {
String empDocumentId = "sample_1";
JsonObject jsonObject = JsonObject.create().put("name", "sundar").put("age", 60);
MutationResult mutateInResult = bucket.defaultCollection().replace(empDocumentId, jsonObject);
System.out.println(" data : " + mutateInResult);
}
I noticed that Update using Replace is doing one modify operation to the document where mutatein is doing two modify operations.
Is that the expected behaviour?
Also if I use a transaction object to create a document, does it come with a delete operation as well.
Thanks,
Manzoor