製品と注文の調和に関する DHF チュートリアルでは、製品は SKU を使用して参照によって注文に含まれます。
https://marklogic.github.io/marklogic-data-hub/tutorial/harmonizing-order-data/
// or a reference to a Product
products.push(makeReferenceObject('Product', order.sku));
...
function makeReferenceObject(type, ref) {
return {
'$type': type,
'$ref': ref
};
}
調和注文レコードの例:
"Order": {
"id": 1,
"products": [
{ "Product": {
"$type": "Product",
"$ref": "12345"
}},
{ "Product": {
"$type": "Product",
"$ref": "54321"
}}
],
"price": 100
}
では、注文レコードで製品オブジェクト参照をどのように利用できるのでしょうか? 参照を解決し、製品情報を出力に組み込むことができるentity service
などの組み込み関数は必要ですか? es.instanceJsonFromDocument
それとも、開発者が独自のカスタム ロジックを実装するための参照にすぎませんか?