简体   繁体   English

存储嵌套的Json对象的数据库架构是什么?

[英]what is the database schema for storing nested Json Objects?

I am getting records for a service contains nested json objects as shown below. 我正在获取包含嵌套json对象的服务记录,如下所示。 I am able catch the result. 我能够捕捉到结果。 I need to store this result in DB. 我需要将此结果存储在数据库中。 here I facing problem in storing these result in db. 在这里,我在将这些结果存储在db中时遇到问题。

[
name:"",
geocode: {
latitude: "45.4168953"
longitude: "-75.6927428"
         },
website: {
title: ""
scope: ""
          },
promotion: {
status:true
           },
.....
.....
.....
]

what might be the database schema for storing this nested JSON Oject. 存储此嵌套JSON Oject的数据库模式可能是什么。

Thanks in advance 提前致谢

Well ,if you are restricted to mysql database , it is simple to new a table named geocode , it has three keys:id ,latitude ,longitude ,then ,in your main table, you have a key named geocode ,whose value is a geocode which points to one row in geocode.It is just a simple one-to-many mapping. 好吧,如果您仅限于mysql数据库,则只需新建一个名为geocode的表,它就有三个键:id,纬度,经度,然后在主表中有一个名为geocode的键,其值是一个地理编码指向地理编码中的一行。这只是一个简单的一对多映射。 So does other composite keys like website , promotion and so on.But according to what I know , NoSQL databases ,such as mongoDB ,has a very good support for JSON object and can absolute meet your requirement. 网站,促销等其他组合键也是如此。但是据我所知,NoSQL数据库(例如mongoDB)对JSON对象有很好的支持,并且可以绝对满足您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM