[英]How to use MarkLogic xdmp:document-insert() function with 'options' argument
When I run this example (from the documentation), I get the error: 当我运行此示例(从文档)时,出现错误:
SEC-INVALIDPERM:
xdmp:document-insert("/example.xml", <a>aaa</a>, <options xmlns="xdmp:document-insert"><permissions><sec:permission xmlns:sec="http://marklogic.com/xdm...</options>)
-- Invalid permissionSEC-INVALIDPERM:
xdmp:document-insert("/example.xml", <a>aaa</a>, <options xmlns="xdmp:document-insert"><permissions><sec:permission xmlns:sec="http://marklogic.com/xdm...</options>)
-无效的权限
xquery version "1.0-ml";
xdmp:document-insert(
"/example.xml",
<a>aaa</a>,
<options xmlns="xdmp:document-insert">
<permissions>{xdmp:default-permissions()}</permissions>
<collections>{
<collection>/my/additional/collection</collection>,
for $coll in xdmp:default-collections()
return <collection>{$coll}</collection>
}</collections>
<quality>10</quality>
</options>)
The function works if there is no options argument. 如果没有选项参数,该函数将起作用。
Running just xdmp:default-permissions()
returns 仅运行
xdmp:default-permissions()
返回
<sec:permission xmlns:sec="http://marklogic.com/xdmp/security">
<sec:capability>update</sec:capability>
<sec:role-id>15080714410678341621</sec:role-id>
</sec:permission>
<sec:permission xmlns:sec="http://marklogic.com/xdmp/security">
<sec:capability>read</sec:capability>
<sec:role-id>15080714410678341621</sec:role-id>
</sec:permission>
How can I use this function with the options argument without this happening? 在没有发生这种情况的情况下,如何使用此函数和options参数?
You might be running this in MarkLogic 8 or below. 您可能正在MarkLogic 8或更低版本中运行它。 This will work in MarkLogic 9 (which is the latest as of the time of writing).
这将在MarkLogic 9(在撰写本文时为最新版本)中有效。 The various options to
xdmp:document-insert
were separate parameters in MarkLogic 8 and below, which were aggregated into a single options
node in MarkLogic 9. xdmp:document-insert
的各种选项在MarkLogic 8及以下版本中是单独的参数,在MarkLogic 9中汇总为单个options
节点。
You might want to check out the signature difference between the 2 variants: 您可能要检查两个变体之间的签名差异:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.