Answer the question
In order to leave comments, you need to log in
Mysql: how to store json data and still avoid duplication?
I'm working with a database of hotels via API, now I'm busy caching static information.
Actually the question is how to store all the data
Here is an example of information about the hotel
{
"gen_timestamp": 1381489054.0071,
"hotels": [
{
"id": "1058790",
"cityId": "895",
"stars": "2",
"pricefrom": null,
"rating": "0.0",
"popularity": "1150",
"propertyType": "",
"checkOut": "",
"checkIn": "",
"distance": "1.00",
"photoCount": "3",
"photos": [
{
"url": "http://photo.hotellook.com/image_v2/original/151594987.jpg",
"width": "298",
"height": "240"
},
{
"url": "http://photo.hotellook.com/image_v2/original/682702387.jpg",
"width": "320",
"height": "240"
},
{
"url": "http://photo.hotellook.com/image_v2/original/700461773.jpg",
"width": "320",
"height": "239"
}
],
"facilities": [
"22",
"7",
"43",
"3",
"41",
"14",
"9",
"83",
"25",
"13",
"56",
"80",
"37"
],
"shortFacilities": [
"restaurant",
"parking",
"laundry",
"internet",
"pool"
],
"location": {
"lat": "6.256917",
"lon": "81.236275"
},
"name": {
"en": "Wila Safari"
},
"address": {
"en": "WEERAWILA"
},
"link": "/LK/Weerawila-895/Wila_Safari-1058790.html"
}
]
}
Answer the question
In order to leave comments, you need to log in
Maybe it makes sense to use a NoSQL database like MongoDB? Just add (update) hotels (json) to the collection, and then use the aggregation framework to make selections.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question