我正在尝试使用商务工具查询自定义字段。给定一个对象,如下
{
[...]
"custom": {
"type": {
"key": "my-category"
},
"fields": {
"returns": [
{obj: {readStatus: "random"},
{travelDestination:"randomTravelDestination"}
],
"description": "example description"
}
}
}例如,我可以通过一个简单的查询轻松地获得description值:
custom(fields(description="example description"))文档:https://docs.commercetools.com/api/projects/custom-fields。
但是,我如何编写一个查询来获取readStatus的值。我特别想看看如何查询具有多个值的数组中的内容?
发布于 2021-03-04 01:23:52
由于您的示例有点令人困惑,您还需要查询完整对象的其他示例吗?如果订单上自定义类型的自定义字段定义如下所示:
{
"name": "shippingAddressPerLineItem",
"label": {
"en": "shippingAddressPerLineItem"
},
"required": false,
"type": {
"name": "Set",
"elementType": {
"name": "String"
}
},
"inputHint": "SingleLine"
} 顺序如下所示(这里删除了一些字段):
{
"type": "Order",
"id": "a67e28b0-15fb-40a9-bd44-1c70dbeb7dd1",
"version": 5,
"custom": {
"type": {
"typeId": "type",
"id": "e4a75e6f"
},
"fields": {
"shippingAddressPerLineItemV2": [
"item2",
"item1",
"address2",
"Address1"
]
}
}
}在orders上查找集合中值为"item2“的order的查询谓词将如下所示:
自定义(字段(shippingAddressPerLineItem= "item2"))
https://stackoverflow.com/questions/66458917
复制相似问题