红红统统
红红统统
  • 发布:2023-10-09 17:10
  • 更新:2023-10-09 19:59
  • 阅读:216

未在表opendb-city-china内发现合法的父子关系标识parentKey

分类:uniCloud

数据表opendb-city-china.schema.json定义如下

{  
  "schema": {  
    "bsonType": "object",  
    "required": ["code", "name"],  
    "permission": {  
        "read": true,  
        "create": false,  
        "update": false,  
        "delete": false  
    },  
    "properties": {  
      "_id": {  
        "description": "ID,系统自动生成"  
      },  
      "code": {  
        "bsonType": "string",  
        "description": "编码"  
      },  
      "parent_code": {  
        "bsonType": "string",  
        "description": "父级编码",  
        "parentKey": "code"  
      },  
      "name": {  
        "bsonType": "string",  
        "description": "城市名称",  
        "title": "城市"  
      },  
      "type": {  
        "bsonType": "int",  
        "description": "城市类型;0省,1市,2区"  
      },  
      "first_letter": {  
        "bsonType": "string",  
        "description": "拼音首字母"  
      },  
      "pinyin": {  
        "bsonType": "string",  
        "description": "城市名称的完整汉语拼音,用于拼音检索"  
      },  
      "zip_code": {  
        "bsonType": "string",  
        "description": "邮政编码",  
        "title": "邮编"  
      }  
    }  
  },  
  "index": [  
    {  
      "IndexName": "code_",  
      "MgoKeySchema": {  
        "MgoIndexKeys": [{  
          "Name": "code",  
          "Direction": "1"  
        }],  
        "MgoIsUnique": true  
      }  
    },  
    {  
      "IndexName": "name",  
      "MgoKeySchema": {  
        "MgoIndexKeys": [{  
          "Name": "name",  
          "Direction": "1"  
        }],  
        "MgoIsUnique": false  
      }  
    },  
    {  
      "IndexName": "first_letter",  
      "MgoKeySchema": {  
        "MgoIndexKeys": [{  
          "Name": "first_letter",  
          "Direction": "1"  
        }],  
        "MgoIsUnique": false  
      }  
    },  
    {  
      "IndexName": "pinyin",  
      "MgoKeySchema": {  
        "MgoIndexKeys": [{  
          "Name": "pinyin",  
          "Direction": "1"  
        }],  
        "MgoIsUnique": false  
      }  
    },  
    {  
      "IndexName": "parent_code",  
      "MgoKeySchema": {  
        "MgoIndexKeys": [{  
          "Name": "parent_code",  
          "Direction": "1"  
        }],  
        "MgoIsUnique": false  
      }  
    },  
    {  
      "IndexName": "zip_code",  
      "MgoKeySchema": {  
        "MgoIndexKeys": [{  
          "Name": "zip_code",  
          "Direction": "1"  
        }],  
        "MgoIsUnique": false  
      }  
    }  
  ]  
}

错误信息如下


前端设置如下
<uni-data-picker v-model="formData.city_id" collection="opendb-city-china" parentKey="parent_code" orderby="value asc" field="code as value, name as text" :step-searh="true" self-field="code" parent-field="parent_code"></uni-data-picker>

      </uni-data-picker>  
2023-10-09 17:10 负责人:无 分享
已邀请:
红红统统

红红统统 (作者) - uniapp 游戏开发爱好者

{
"schema": { 没有这部分就对了
"bsonType": "object",

数据表定义错误
删除以下信息,其他不动
"schema": {

},
"index": [
{
"IndexName": "code_",
"MgoKeySchema": {
"MgoIndexKeys": [{
"Name": "code",
"Direction": "1"
}],
"MgoIsUnique": true
}
},
{
"IndexName": "name",
"MgoKeySchema": {
"MgoIndexKeys": [{
"Name": "name",
"Direction": "1"
}],
"MgoIsUnique": false
}
},
{
"IndexName": "first_letter",
"MgoKeySchema": {
"MgoIndexKeys": [{
"Name": "first_letter",
"Direction": "1"
}],
"MgoIsUnique": false
}
},
{
"IndexName": "pinyin",
"MgoKeySchema": {
"MgoIndexKeys": [{
"Name": "pinyin",
"Direction": "1"
}],
"MgoIsUnique": false
}
},
{
"IndexName": "parent_code",
"MgoKeySchema": {
"MgoIndexKeys": [{
"Name": "parent_code",
"Direction": "1"
}],
"MgoIsUnique": false
}
},
{
"IndexName": "zip_code",
"MgoKeySchema": {
"MgoIndexKeys": [{
"Name": "zip_code",
"Direction": "1"
}],
"MgoIsUnique": false
}
}
]

要回复问题请先登录注册