在数据中心教程中,https://marklogic.github.io/marklogic-data-hub/tutorial/4x/harmonize-order-data-by-custom-code/
步骤: 3b -自定义内容插件
单击CONTENT选项卡。将内容插件代码替换为:没有显示任何内容--页面源代码显示它要导入:
raw.githubusercontent.com/marklogic-community/marklogic-data-hub/develop/examples/online-store/plugins/entities/Order/harmonize/Harmonize命令/
/content.sjs
但是这个链接报告: 404:找不到
我在哪里能找到丢失的片段?
发布于 2020-01-06 13:55:05
发布于 2020-01-06 10:28:26
我假设,如果您从上面的解释中获取3段代码片段,并将它们按如下方式组合起来:
var orders = jsearch
.collections('Order')
.documents()
.where(
jsearch.byExample({
'id': id
})
)
.result('value')
.results.map(function(doc) {
return doc.document.envelope.instance;
});
/* The following property is a local reference. */
var products = [];
var price = 0;
for (var i = 0; i < orders.length; i++) {
var order = orders[i];
if (order.sku) {
products.push(makeReferenceObject('Product', order.sku));
price += xs.decimal(parseFloat(order.price)) * xs.decimal(parseInt(order.quantity, 10));
}
}
return {
'$attachments': attachments,
'$type': 'Order',
'$version': '0.0.1',
'id': id,
'price': price,
'products': products
}这将为您提供createContent函数的代码。因此,将createContent函数中的任何内容替换为上面的片段。
https://stackoverflow.com/questions/59571099
复制相似问题