【发布时间】:2020-12-17 06:07:44
【问题描述】:
我创建了一个名为“专家”的撇号片段,其中包含几位专家的数据。片段模式中的一个字段是 COUNTRY (他们访问过的国家的名称),它由 array 连接。现在如何获取与国家对应的值相同的专家列表。即..我怎样才能只得到那些访问过印度或中国的专家。 [我使用撇号作为无头]
我的架构如下所示:
module.exports = {
name: 'specialist',
extend: 'apostrophe-pieces',
label: 'Specialist',
restApi:true,
pluralLabel: 'Specialists',
addFields: [
{
name: 'name',
label: 'Name',
type: 'string',
required: true
},
{
name: 'photo',
label: 'Photo',
type: 'singleton',
widgetType: 'apostrophe-images',
options: {
aspectRatio: [ 1, 1 ],
minSize: [ 300, 300 ],
limit: 1
}
},
{
name: 'phoneNumber',
label: 'Phone Number',
type: 'integer',
required: true
},
{
name: 'email',
label: 'E Mail',
type: 'email',
required: true
}
{
name: '_country',
label: 'Country',
type: 'joinByOne,
required: true,
withType: 'country'
},
【问题讨论】:
-
请提供您迄今为止尝试过的内容以及有关上下文的更多信息。这是在页面中吗?在小部件中?您已经参考了哪些文档?
-
我想获取其国家被选为印度的所有专家的列表...其中国家是专家模式中的 joinbyOne 部分。我曾经像这样过滤“api/v1/specialist?country[]=India”,但没有用……相反,我得到了所有的专家数据
标签: apostrophe-cms