I am new to this couchbase we are planning to use this for our cms project to store meta-data.
I am trying to insert below Json Data and trying to Query using JOIN on 3 different types but i am facing issues. can some one help on this…
INSERT INTO default (key, value) VALUES (“hotel_1003”, {“hotelcode” : “1003”, “type”: “hotel”, “providercode” : “144”, “booking_date_range” : “18-11-2016 to 22-11-2016”, “travel_date_range” : “18-11-2016 to 22-11-2016”, “tenantid” : “Leela”,“companyid” : “” });
INSERT INTO default (key, value) VALUES (“hotel_facilities_09”, {“id”:“09”,“hotel_id”:“hotel_1003”, “type”: “facilities”, “facilities”:[{“contenttype”:“image”, “category”:“thumbnail”, “content_url”:“http://www.ibsplc.com/logo_8.png"},{“contenttype”:"image”, “category”:“thumbnail”, “content_url”:“http://www.ibsplc.com/logo_9.png"},{“contenttype”:"image”, “category”:“thumbnail”, “content_url”:“http://www.ibsplc.com/logo_10.png”}]});
INSERT INTO default (key, value) VALUES (“hotel_mealplan_01”, {“id”:“09”,“hotel_id”:“hotel_1003”, “type”: “mealplans”, “meal_plans”:[{“contenttype”:“image”, “category”:“thumbnail”, “content_url”:“http://www.ibsplc.com/logo_8.png"},{“contenttype”:"image”, “category”:“small”, “content_url”:“http://www.ibsplc.com/logo_9.png"},{“contenttype”:"image”, “category”:“small”, “content_url”:“http://www.ibsplc.com/logo_10.png”}]});
join is working fine with 2 diff types but when i try on 3 diff types i am facing issue
working Query:
select * from default mealplans
JOIN default hotel ON KEYS mealplans.hotel_id
WHERE mealplans.hotel_id=“hotel_1003”
AND mealplans.type=“mealplans”;
Facing issue below Query:
select * from default mealplans
JOIN default hotel ON KEYS mealplans.hotel_id
JOIN default facilities ON KEYS facilities.hotel_id
WHERE mealplans.hotel_id=“hotel_1003”
AND mealplans.type=“mealplans” AND faciliti.type=“facilities”;
Please some one help on issue query, is any syntax issue in above query or my Data modeling is wrong…