问题
I have managed document named 123456.xml
and I am trying to update it with dls library function as below,
declare variable $uri:= "/abc/123456_xml_versions/1-123456.xml";
dls:document-is-managed($uri),
dls:document-checkout-update-checkin($uri, $xml, 'Update', fn:true())
Above script snip is throwing below exception,
[1.0-ml] DLS-DOCUMENTVERSION: (err:FOER0000) Cannot update or checkout document version /abc/123456_xml_versions/1-123456.xml
This is an existing migration operation of the application which is updating all versions of the document.
回答1:
Don't give DLS functions URIs from the versions
directory. Those URIs are managed by DLS. Just give it the canonical URI of the document you want to update, and DLS will automatically increment the version for you:
declare variable $uri:= "/abc/123456/123456.xml";
...
回答2:
dls:document-checkout-update-checkin($uri, , 'Update', fn:true())
The second parameter should be the document node you are replacing the existing document with.
You may also want to check dls:document-checkout-status to see if another user currently has the document checked out.
回答3:
I recommend that you study, fully understand (or ask for support if you do not) and implement the procedures here https://docs.marklogic.com/guide/relnotes/chap4#id_65479 prior to any work with DLS documents after an ML update (from V8- to 9+). DLS V9 ships out of the box INCOMPATIBLE with prior versions until you perform the upgrade. The upgrade is NOT performed automatically, and the symptoms of not upgrading or partial upgrade may not be noticed (at first). There is good detail on the new functions for checking the status of all your DLS documents. These are useful even after you upgrade to validate that the required permissions, properties and collections are still intact.
Then I encourage you to study the architecture and procedures for working with DLS documents. Anything outside of these procedures is not supported, and very tricky to get right (which is why its not supported). Note that you may find doing a bulk checkout , then update then bulk check in works better for your use case then the one-shot document-checkout-insert-checkin. Also note the permission and index requirements for DLS documented.
来源:https://stackoverflow.com/questions/57206843/marklogic-10-managed-document-throwing-exception-on-dlsdocument-checkout-upda