Reputation: 417
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.
How can I achieve this using xdmp:document-insert
?
Upvotes: 1
Views: 456
Reputation: 66723
This is a minimal example that inserts the 6 documents and sets the "flags" collection with dummy content <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:
Upvotes: 3