unicloud 云数据库中 怎么添加一个 地理位置坐标字段
我用 ai 写了一个不知道是不是正确的?
"location":{
"bsonType": "object",
"description": "活动位置(GeoJSON格式)",
"title": "活动位置",
"properties":{
"type":{
"bsonType": "string",
"description": "位置类型,必须为Point",
"enum": ["Point"]
},
"coordinates":{
"bsonType": "array",
"description": "位置坐标 [经度, 纬度]",
"minItems": 2,
"maxItems": 2,
"items": {
"bsonType": "number"
}
}
},
"required": ["type", "coordinates"]
},
lacorey (作者)
感谢,但是里面具体怎么存放 数据的结构 方便以后根据坐标进行计算附近这些 "properties":{ } 这里面怎么写结构呢?
2025-04-23 16:54
lacorey (作者)
文档里也没有看到位置字段的结构是怎样的
"location":{
"bsonType": "object",
"description": "活动位置(GeoJSON格式)",
"title": "活动位置",
"properties":{
"type":{
"bsonType": "string",
"description": "位置类型,必须为Point",
"enum": ["Point"]
},
"coordinates":{
"bsonType": "array",
"description": "位置坐标 [经度, 纬度]",
"minItems": 2,
"maxItems": 2,
"items": {
"bsonType": "number"
}
}
},
"required": ["type", "coordinates"]
},
我这样写是不是对的?这是通过ai写的
2025-04-25 02:25
DCloud_uniCloud_CRL
回复 lacorey: bsontype 设置为 object 就可以了,其他字段不用关心。
2025-04-26 11:12