XQUERY函数用于将文档从一个数据库连接和复制文档与另一个数据库中

发布于 2025-02-10 18:09:28 字数 75 浏览 2 评论 0 原文

我可以使用什么Xquery函数与MarkLogic数据库连接,并将集合从该数据库复制到位于同一MarkLogic服务器中的另一个数据库。

What xquery functions I can use to connect with a MarkLogic database and copy the collection from that database to another database located in the same MarkLogic server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满身野味 2025-02-17 18:09:28

您可以使用 xdmp:Invoke-function() 和在选项中指定不同的数据库

xquery version "1.0-ml";
for $doc in cts:search(doc(), cts:collection-query("collection-name"))
let $uri := $doc/base-uri()
let $collections := xdmp:document-get-permissions($uri)
let $permissions := xdmp:document-get-collections($uri)
return
  xdmp:invoke-function(function() { 
      xdmp:document-insert($uri, $doc, $permissions, $collections) 
    },
    <options xmlns="xdmp:eval">
      <database>{ xdmp:database("GTM2_TEST") }</database>
    </options>)

如果您的收藏集中有大量文档,那么您可能需要查看 XDMP:Spawn-function() 或使用批处理工具进行工作,例如 corb 避免了扩展的树缓存错误和/或超时,试图将它们全部处理为一个巨大的交易。

You can use xdmp:invoke-function() and specify a different database in the options.

xquery version "1.0-ml";
for $doc in cts:search(doc(), cts:collection-query("collection-name"))
let $uri := $doc/base-uri()
let $collections := xdmp:document-get-permissions($uri)
let $permissions := xdmp:document-get-collections($uri)
return
  xdmp:invoke-function(function() { 
      xdmp:document-insert($uri, $doc, $permissions, $collections) 
    },
    <options xmlns="xdmp:eval">
      <database>{ xdmp:database("GTM2_TEST") }</database>
    </options>)

If you have a really large number of documents in the collection, then you might want to look at either xdmp:spawn-function(), or doing the work with a batch tool, such as CoRB to avoid Expanded Tree Cache errors and/or timeouts from an attempt to process them all in one giant transaction.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文