Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created October 13, 2016 13:07
Show Gist options
  • Save ableasdale/07e0115346d216464a3e93258c4fe5d8 to your computer and use it in GitHub Desktop.
Save ableasdale/07e0115346d216464a3e93258c4fe5d8 to your computer and use it in GitHub Desktop.
Simple Document move example
xquery version "1.0-ml";
for $i in cts:uris (
(),
("limit=10000"),
cts:not-query(cts:collection-query("moved"))
)
let $document := fn:doc($i)
return
(xdmp:document-add-collections($i, "moved"),
xdmp:spawn-function(function() {xdmp:document-insert($i, $document), xdmp:commit()},
<options xmlns="xdmp:eval">
<database>{xdmp:database("%YOUR_TARGET_DATABASE_HERE%")}</database>
<transaction-mode>update</transaction-mode>
</options>))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment