如何在 Marklogic 中将现有文档从一个集合移动到另一个 database/forest
how to move existing documents from one collection to another within the same database/forest in Marklogic
有人可以建议一些方法,将现有文档从一个集合(或默认集合)移动到 MarkLogic 中同一 database/forest 中的另一个集合。
您需要在相同的 uri 中重新插入文档,但添加 new/different 集合。
您需要使用类似 cts:search()
and then do a xdmp:document-insert()
的方式查询文档,第 4 个参数是您放置集合的位置。
如果文档很多,您需要根据文档的大小将其批量处理,大小从 10 到 1,000,如果您不确定 100 是否是一个好的起点。
如果数量非常大,请使用 corb2。
您可以使用函数 xdmp:document-set-collections()
to set the collections a document is in without reinserting it. If you just want to make specific changes, xdmp:document-add-collections()
and xdmp:document-remove-collections()
可用于添加或删除一些集合而无需修改其余部分。
正如 Tyler 所说,如果要处理大量文档,您将需要对其进行批处理或使用 corb。
有人可以建议一些方法,将现有文档从一个集合(或默认集合)移动到 MarkLogic 中同一 database/forest 中的另一个集合。
您需要在相同的 uri 中重新插入文档,但添加 new/different 集合。
您需要使用类似 cts:search()
and then do a xdmp:document-insert()
的方式查询文档,第 4 个参数是您放置集合的位置。
如果文档很多,您需要根据文档的大小将其批量处理,大小从 10 到 1,000,如果您不确定 100 是否是一个好的起点。
如果数量非常大,请使用 corb2。
您可以使用函数 xdmp:document-set-collections()
to set the collections a document is in without reinserting it. If you just want to make specific changes, xdmp:document-add-collections()
and xdmp:document-remove-collections()
可用于添加或删除一些集合而无需修改其余部分。
正如 Tyler 所说,如果要处理大量文档,您将需要对其进行批处理或使用 corb。