Description
So we can address your issue, please include the following:
Version of MarkLogic Java Client API
Java API v4.1.0
Version of MarkLogic Server
MarkLogic v10
Java version
java version "11.0.7" 2020-04-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.7+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.7+8-LTS, mixed mode)
OS and version
OS Name: Microsoft Windows 10 Home Single Language
OS Version: 10.0.19041 N/A Build 19041
Input:
I am using MarkLogic v10 and Java API v4.1.0. My requirement is to clear collections from the specific document,
I am using the below code snippet to clear all the collections,
XMLDocumentManager xmlDocumentManager = client.newXMLDocumentManager();
DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle();
xmlDocumentManager.readMetadata("/test/inventory", metadataHandle);
DOMHandle domHandle = new DOMHandle();
xmlDocumentManager.read("/test/inventory", domHandle);
metadataHandle.getCollections().clear();
xmlDocumentManager.write("/test/inventory", metadataHandle, domHandle);
I already posted question on StackOverflow :
https://stackoverflow.com/questions/63734972/clear-collections-is-not-working-in-java-api
Expected output:
After running the above snippet, it should remove all the collections from the document but it is not happening.