Loopbackjs 环回:如何在环回中定义具有字符串数组的属性?

Loopbackjs 环回:如何在环回中定义具有字符串数组的属性?,loopbackjs,loopback,Loopbackjs,Loopback,我在环回应用程序中有以下模型,将在MongoDB中持久化: 模型 咖啡店名称: 身份证 名称(字符串) 城市(字符串) 问题: 现在,我希望能够在名为“tags”的新属性中存储字符串列表: 标记(字符串数组) 与其他必要的模型没有关系。我只需要一个简单的字符串列表 我怎样才能做到这一点 代码: 这很简单: { "name": "CoffeeShop", "plural": "CoffeeShops", "base": "PersistedModel", "idInject

我在环回应用程序中有以下模型,将在MongoDB中持久化:

模型 咖啡店名称:

  • 身份证
  • 名称(字符串)
  • 城市(字符串)
问题: 现在,我希望能够在名为“tags”的新属性中存储字符串列表:

  • 标记(字符串数组)
与其他必要的模型没有关系。我只需要一个简单的字符串列表

我怎样才能做到这一点

代码: 这很简单:

{
  "name": "CoffeeShop",
  "plural": "CoffeeShops",
  "base": "PersistedModel",
  "idInjection": true,
  "options": {
    "validateUpsert": true
  },
  "properties": {
    "name": {
      "type": "string",
      "required": true
    },
    "city": {
      "type": "string",
      "required": true
    },
    "tags": {
      "type": [
        "string"
      ],
      "required": false
    }
},
  "validations": [],
  "relations": {},
  "acls": [],
  "methods": {}
}
这很简单:

{
  "name": "CoffeeShop",
  "plural": "CoffeeShops",
  "base": "PersistedModel",
  "idInjection": true,
  "options": {
    "validateUpsert": true
  },
  "properties": {
    "name": {
      "type": "string",
      "required": true
    },
    "city": {
      "type": "string",
      "required": true
    },
    "tags": {
      "type": [
        "string"
      ],
      "required": false
    }
},
  "validations": [],
  "relations": {},
  "acls": [],
  "methods": {}
}