[英]how to document insert with the collections in Marklogic using XQuery
I have a requirement where in I have to insert documents with name 1 to 6 with extension.xml, set the collection as "flags" to each of the documents in one go, and insert them into a directory called America.我有一个要求,我必须插入名称为 1 到 6 且扩展名为 xml 的文档,将集合设置为 go 中的每个文档的“标志”,然后将它们插入名为 America 的目录中。
How can I achieve this using xdmp:document-insert
?如何使用xdmp:document-insert
实现此目的?
This is a minimal example that inserts the 6 documents and sets the "flags" collection with dummy content <doc/>
.这是一个插入 6 个文档并使用虚拟内容<doc/>
设置“标志”集合的最小示例。
for $i in (1 to 6)
let $uri := "/America/"||$i||".xml"
return
xdmp:document-insert($uri, <doc/>,
<options xmlns="xdmp:document-insert">
<collections>
<collection>flags</collection>
</collections>
</options>)
with the URIs:使用 URI:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.