MarkLogic版本 - 9.0-6.2
当我尝试在xdmp.save命令下运行时,我收到以下错误
xdmp.save('C:\\copyright\\cust.txt',fn.collection('customer'))
XDMP-ARGTYPE:xdmp.save(“C:\ copyright \ cust.txt”,Sequence(cts.doc(“/ customer / cust1.json”),cts.doc(“/ customer / cust2.json”),cts .doc(“/ customer / cust3.json”),...)) - arg2不是Node类型
我能够从fn.doc表达式成功获取数据。
xdmp.save('C:\\copyright\\cust.txt',fn.doc('/customer/customer1.json'))
有关如何将集合中的所有文档传递给xdmp.save API的任何帮助?
问题是xdmp.save
期望第二个参数是单个节点,但fn.collection
返回一个Sequence。最简单的解决方案是将Sequence转换为数组,该数组被视为单个节点。
xdmp.save('C:\\copyright\\cust.txt', fn.collection('customer').toArray())