lacorey
lacorey
  • 发布:2025-04-02 00:37
  • 更新:2025-04-03 17:32
  • 阅读:74

unicloud 云数据库中 怎么添加一个 地理位置坐标字段

分类:uniCloud

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"]  
        },
2025-04-02 00:37 负责人:无 分享
已邀请:
DCloud_uniCloud_CRL

DCloud_uniCloud_CRL

地理位置可以定义为object,看下文档:https://doc.dcloud.net.cn/uniCloud/schema.html#bsontype

  • 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

要回复问题请先登录注册