I am new to web development and am about half way through a full-stack web development course. How would I go about calling the value of the data stored with the source: "Rotten Tomatoes"?
I have tried Ratings[1].Value and it does not seem to work.
var movieObject = JSON.parse(body);
console.log('Rotten Tomatoes Rating: ', movieObject.Ratings[1].Value);
Body Content:
{
"Title": "Avatar",
"Year": "2009",
"Rated": "PG-13",
"Released": "18 Dec 2009",
"Runtime": "162 min",
"Genre": "Action, Adventure, Fantasy",
"Director": "James Cameron",
"Writer": "James Cameron",
"Actors": "Sam Worthington, Zoe Saldana, Sigourney Weaver, Stephen Lang",
"Plot": "A paraplegic marine dispatched to the moon Pandora on a unique mission becomes torn between following his orders and protecting the world he feels is his home.",
"Language": "English, Spanish",
"Country": "UK, USA",
"Awards": "Won 3 Oscars. Another 85 wins & 128 nominations.",
"Poster": "https://images-na.ssl-images-amazon.com/images/M/MV5BMTYwOTEwNjAzMl5BMl5BanBnXkFtZTcwODc5MTUwMw##._V1_SX300.jpg",
"Ratings": [
{
"Source": "Internet Movie Database",
"Value": "7.8/10"
},
{
"Source": "Rotten Tomatoes",
"Value": "83%"
},
{
"Source": "Metacritic",
"Value": "83/100"
}
],
"Metascore": "83",
"imdbRating": "7.8",
"imdbVotes": "967,488",
"imdbID": "tt0499549",
"Type": "movie",
"DVD": "22 Apr 2010",
"BoxOffice": "$749,700,000",
"Production": "20th Century Fox",
"Website": "http://www.avatarmovie.com/",
"Response": "True"
}
Your call is correct, so it must be something in the setup. Best guess is that you're calling JSON.parse() on an object that has already been converted to an object.
Related
I am trying to connect a webhook to the nhs website using ibm cloud functions and then output result to my watson assistant chatbot
function main(params) {
const options = {
uri: "https://api.nhs.uk/conditions/coronavirus-covid-19/"+encodeURIComponent(params.query_topic)+"/?url=https://api.eu-gb.assistant.watson.cloud.ibm.com/instances/...",
json: true
}
return rp(options)
.then(res => {
return {text : res}
})
}
the webhook is successful and it passes the parameters to return information from the correct page
I want the result to just show the main body of text not all the tags so starting from "The main symptoms of coronavirus (COVID-19) are:..."
This is the full output(unable to add images)
"{"#context": "http://schema.org", "#type": "WebPage", "name": "Symptoms of coronavirus", "copyrightHolder": {"name": "Crown Copyright", "#type": "Organization"}, "license": "https://developer.api.nhs.uk/terms", "author": {"url": "https://www.nhs.uk", "logo": "https://www.nhs.uk/nhscwebservices/documents/logo1.jpg", "email": "nhswebsite.servicedesk#nhs.net", "#type": "Organization", "name": "NHS website"}, "about": {"#type": "WebPage", "name": "Symptoms of coronavirus"}, "description": "Find out about the main symptoms of coronavirus (COVID-19) and where to get medical advice if you think you have them.", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/symptoms/", "lastReviewed": ["2021-03-04T11:27:00+00:00", "2021-03-18T11:27:00+00:00"], "breadcrumb": {"#context": "http://schema.org", "#type": "BreadcrumbList", "itemListElement": [{"#type": "ListItem", "position": 0, "item": {"#id": "https://www.nhs.uk/conditions/", "name": "Health A to Z", "genre": "condition"}}, {"#type": "ListItem", "position": 1, "item": {"#id": "https://www.nhs.uk/conditions/coronavirus-covid-19/", "name": "Coronavirus (COVID-19)", "genre": "hub"}}, {"#type": "ListItem", "position": 2, "item": {"#id": "https://www.nhs.uk/conditions/coronavirus-covid-19/symptoms/", "name": "Symptoms of coronavirus", "genre": "guide"}}]}, "genre": "guide", "hasPart": [{"#type": "WebPageElement", "name": "symptoms", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/symptoms/#symptoms", "description": "The main symptoms of coronavirus (COVID-19) are a high temperature, a new, continuous cough and a loss or change to your sense of smell or taste.", "text": "<p>The main symptoms of coronavirus (COVID-19) are:</p><ul><li>a high temperature \u2013 this means you feel hot to touch on your chest or back (you do not need to measure your temperature)</li><li>a new, continuous cough \u2013 this means coughing a lot for more than an hour, or 3 or more coughing episodes in 24 hours (if you usually have a cough, it may be worse than usual)</li><li>a loss or change to your sense of smell or taste \u2013 this means you've noticed you cannot smell or taste anything, or things smell or taste different to normal</li></ul><p>If you have any of these symptoms, get a test to check if you have coronavirus and stay at home until you get your result.</p>", "title": ""}], "relatedLink": [{"#type": "LinkRole", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/", "name": "Coronavirus (COVID-19)", "linkRelationship": "Navigation", "position": 0}, {"#type": "LinkRole", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/symptoms/", "name": "Symptoms of coronavirus", "linkRelationship": "Navigation", "position": 1}, {"#type": "LinkRole", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/self-isolation-and-treatment/", "name": "Self-isolation and treating coronavirus symptoms", "linkRelationship": "Navigation", "position": 2}, {"#type": "LinkRole", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/testing-and-tracing/", "name": "Testing and tracing for coronavirus", "linkRelationship": "Navigation", "position": 3}, {"#type": "LinkRole", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/people-at-higher-risk/", "name": "People at higher risk from coronavirus", "linkRelationship": "Navigation", "position": 4}, {"#type": "LinkRole", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/social-distancing/", "name": "Social distancing and changes to everyday life", "linkRelationship": "Navigation", "position": 5}, {"#type": "LinkRole", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/research/", "name": "Take part in coronavirus research", "linkRelationship": "Navigation", "position": 6}, {"#type": "LinkRole", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/coronavirus-vaccination/", "name": "Coronavirus vaccination", "linkRelationship": "Navigation", "position": 7}, {"#type": "LinkRole", "url": "https://www.nhs.uk/conditions/coronavirus-covid-19/long-term-effects-of-coronavirus-long-covid/", "name": "Long-term effects of coronavirus (long COVID)", "linkRelationship": "Navigation", "position": 8}], "mainEntityOfPage": [{"identifier": "0", "name": "section heading", "position": 0, "#type": "WebPageElement", "headline": "", "text": "", "mainEntityOfPage": [{"position": 0, "identifier": "1", "text": "<p>If you have any of the main symptoms of coronavirus (COVID-19), get a test as soon as possible. Stay at home until you get the result.</p><h2><b>Main symptoms</b></h2><p>The main symptoms of coronavirus are:</p><ul><li><b>a high temperature</b> \u2013 this means you feel hot to touch on your chest or back (you do not need to measure your temperature)</li><li><b>a new, continuous cough</b> \u2013 this means coughing a lot for more than an hour, or 3 or more coughing episodes in 24 hours (if you usually have a cough, it may be worse than usual)</li><li><b>a loss or change to your sense of smell or taste</b> \u2013 this means you've noticed you cannot smell or taste anything, or things smell or taste different to normal</li></ul><p>Most people with coronavirus have at least 1 of these symptoms.</p><h2>What to do if you have symptoms</h2><p>If you have any of the main symptoms of coronavirus:</p><ol><li>Get a test to check if you have coronavirus as soon as possible.</li><li>You and anyone you live with should stay at home and not have visitors until you get your test result \u2013 only leave your home to have a test.</li></ol><p>Anyone in your support bubble should also stay at home if you have been in close contact with them since your symptoms started or during the 48 hours before they started.</p>", "#type": "WebPageElement", "name": "markdown"}, {"position": 1, "#type": "WebPageElement", "name": "Find a service", "identifier": "2", "text": "<p>Get a test to check if you have coronavirus on GOV.UK</p>\n"}, {"position": 3, "#type": "WebPageElement", "name": "urgent", "identifier": "5", "text": "<h2>Use the NHS 111 online coronavirus service if:</h2><div class=\"block-richtext\"><ul><li>you're worried about your symptoms</li><li>you're not sure what to do</li></ul></div>\n<div class=\"block-action_link\"><div class=\"nhsuk-action-link\">\n <a class=\"nhsuk-action-link__link\" href=\"https://111.nhs.uk/covid-19/\" >\n <svg class=\"nhsuk-icon nhsuk-icon__arrow-right-circle\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n <path d=\"M12 2a10 10 0 0 0-9.95 9h11.64L9.74 7.05a1 1 0 0 1 1.41-1.41l5.66 5.65a1 1 0 0 1 0 1.42l-5.66 5.65a1 1 0 0 1-1.41 0 1 1 0 0 1 0-1.41L13.69 13H2.05A10 10 0 1 0 12 2z\"></path>\n </svg>\n <span class=\"nhsuk-action-link__text\">Use the NHS 111 online coronavirus service</span>\n </a>\n</div>\n</div>\n<div class=\"block-richtext\"><p>Call 111 if you cannot get help online. Do not go to places like a GP surgery, hospital or pharmacy.</p></div>"}]}, {"identifier": "0", "name": "section heading", "position": 1, "#type": "WebPageElement", "headline": "", "text": "", "mainEntityOfPage": [{"position": 0, "#type": "WebPageElement", "name": "Callout", "identifier": "4", "text": "<h2>Babies and children</h2><p>Call 111 if you're worried about a baby or child under 5.</p><p>If your child seems very unwell, is getting worse or you think there's something seriously wrong, call 999.</p><p>Do not delay getting help if you're worried. Trust your instincts.</p><p>Get more advice about coronavirus in children.</p>"}]}], "dateModified": "2021-03-04T20:52:05+00:00"}"
I have read through IBM Watson documentation, NHS API documentation and browsed through Stack Overflow, but couldn't find anything to help me.
How are you displaying the response now? Just $webhook_response_1?
If so, then I think this documentation will help.
About half way down there's a table with two columns: condition and response. See Screenshot
It says that if you make your condition $webhook_response_1 then your response would be something like this: Your words in Spanish: <? $webhook_result_1.translations[0].translation ?>.
Obviously, change the static text to what you're looking for and change the properties to match what your own JSON is returning.
EDIT:
Based on your comments you are trying to display the data with this: $webhook_result_1.text.mainEntityOfPage[9].text
However, based on the format of your json you would actually need to use $webhook_result_1.mainEntityOfPage[0].mainEntityOfPage[0].text
As mentioned in the posting above, currently you perform your request to the nhs web site, receive a response as a json payload, then return the complete response back to the Watson Assistant web hook. If you only require a sub element of the returned payload, you need either to extract that element via your cloud function and return this sub element. Or you can within Watson Assistant only "display" within the dialog bode the sub element, i.e. If you return the response to variable $webhook_result_1, then as show above you only use in the node $webhook_result_1.description (the json elements are not clear from above, so you may need to adjust to be correct). Its easier to manipulate the returned json within your cloud function, then within assistant.
I am using adaptive card version 1.2.6 for MS Teams bot integration. As per my UI Requirements, I need to display compact style choice set options in a single line. But adaptive card designers displaying horizontally. Is it possible to show options in a single line(vertically)?
Design JSON:
{
"spacing": "Small",
"id": "leave_duration",
"placeholder": "Leave Duration",
"type": "Input.ChoiceSet",
"style": "expanded",
"isMultiSelect": true,
"choices": [
{
"title": "First Half",
"value": "First Half"
},
{
"title": "Second Half",
"value": "Second Half"
},
{
"title": "Full Day",
"value": "Full Day"
}
],
"separator": true
}
I have an index on algolia, each document like this.
{
"title": "sample title",
"slug": "sample slug",
"content": "Head towards Rajinder Da Dhaba for some insanely delicious Kebabs!!",
"Tags": ["fashion", "shoes"],
"created": "2017-03-30T12:10:08.815Z",
"city": "delhi",
"user": {
"_id": "58b6f3ea884fdc682a820dad",
"description": "Roughly, somewhere between insanity and zen. Mostly the guy at the window seat!",
"displayName": "Jon Doe"
},
"type": "Post",
"places": [
{
"name": "Rajinder Da Dhaba",
"slug": "Rajinder-Da-Dhaba-safdarjung-9e9ffe",
"location": {
"_geoloc": [
{
"name": "Safdarjung",
"_id": "59611a2c2094b56a39afcbce",
"coordinates": {
"lng": 77.2030268,
"lat": 28.5685586
}
}
]
}
}
],
"objectID": "58dcf5a0355b590560d6ad68",
}
I want to implement autocomplete on this.
However, when i see the demos present in algolia dashboard, i found out that it returns the complete documents.
I want to only match on user.displayName, place.name, and title
and return only these fields as suggestions in the autocomplete results instead of complete documents, which match.
I know I can create separate indexes for users, places;
But is this possible with only a single index??
Did you had a look at http://algolia.com/doc/tutorials/search-ui/autocomplete/auto-complete/ ?
It shows how to have a custom display from an index.
To match on on user.displayName, place.name, and title
you can configure the "searchable attributes" from the algolia dashboard.
I am trying to extract user reviews linked to a business from the google places API.
I am using the requests library :
import requests
r = requests.get('https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJlc_6_jM4DW0RQUUtaQj2_lk&key=AIzaSyBuS4meH_HW3FO1cpUaCm6jbqzRCWe7mjc')
json_data_dic = r.json()
print(json_data_dic)
So I get the json object converted to a python object for me to parse and extract my user ratings & reviews .
I get a "lump" of text back (see below). As someone new to python/coding, all I see is a tangle of nested dictionaries and lists. In situations where there is nesting- how do I refer to an items such as 'rating', or the 'text' of the review?
Any guidance would be appreciated.
{
"html_attributions": [],
"result": {
"reviews": [
{
"relative_time_description": "in the last week",
"profile_photo_url": "//lh6.googleusercontent.com/-06-3qCU8jEg/AAAAAAAAAAI/AAAAAAAAACc/a1z-ga9rOhs/photo.jpg",
"rating": 1,
"time": 1481050128,
"author_name": "Tass Wilson",
"text": "Worse company I've had the pleasure of dealing with. They don't follow through on what they say, their technical support team knows jack all. They are unreliable and lie. The only good part about their entire team is the sales team and thats to get you in the door, signed up and committed to a 12 month contract so they can then screw you over many times without taking you out to dinner first\n\nI would literally rather go back to using smoke signals and frikkin carrier pigeons then use Orcon again as an internet provider",
"aspects": [
{
"rating": 0,
"type": "overall"
}
],
"language": "en",
"author_url": "https://www.google.com/maps/contrib/116566965301711692941/reviews"
},
{
"relative_time_description": "3 weeks ago",
"rating": 1,
"time": 1479258972,
"author_name": "Anne-Marie Petersen",
"text": "I have experienced nothing but pain with them - from the start to (almost the end) in fact so I could skip the 5 days without internet I have had my other provider set up my fibre and just cut the loss of the extra month as the final bad money I will ever have to pay them. I called them to ask why I hadn't been offered an upgrade to fibre - I was told I wasn't eligible for fibre due to bad credit rating. I flipped out. Namely because I have a good credit score - it's something I check regularly. So I said well how do you know - they gave me the number of the company they use so I could call them. I hung up, called the number - it was the YELLOW PAGES number. I call back, I get given the same number (same person answered) I am seeing RED by this point, so I say just give me the name of the company. I find the number myself - I then call them only to be told they don't even work with Orcon. Then the guy offers to do a quick scan of the system to see if my name is in then. Doesn't even appear. Round and round the mulberry bush - I called another company and finally have had my fibre installed and everything ago. I still have no idea how to use the extra remote they've given me but the internet is fabulous. Oh - and I also got sick of every time something was wrong it was always MY fault even though I knew they would go offline and fix something. I used to WORK at a telco company let me tell you I get the system. Finally I have to send the modem back but I've already been advised to take it into their head office and take a photo of myself handing it in because they have on numerous occasions said to people that they've never received the modem even though they had.... why the hell are they still even a company????\n\nUPDATE>> got sent two cancellation notices - neither of which were for accounts that I had power over apparently. Have taken to twitter to have a public forum so they can't get me on not returning my modem.",
"aspects": [
{
"rating": 0,
"type": "overall"
}
],
"language": "en",
"author_url": "https://www.google.com/maps/contrib/113533966859873380749/reviews"
},
{
"relative_time_description": "4 months ago",
"profile_photo_url": "//lh4.googleusercontent.com/-lAEJbEHaIoE/AAAAAAAAAAI/AAAAAAAAEFo/IATRvjK2Oak/photo.jpg",
"rating": 1,
"time": 1469481312,
"author_name": "Keith Rankine",
"text": "Everything works well until you try to cancel your account. Do not be fooled into thinking you cannot give them notice to cancel within your contract term. They will try everything in their power to squeeze an extra month from you. \nI had a 12 month contract and informed them of my wish to cancel on the anniversary on that sign up date. All their emails were carefully worded to imply that this could not be done. If read carefully, and you argue, they will agree to it.",
"aspects": [
{
"rating": 0,
"type": "overall"
}
],
"language": "en",
"author_url": "https://www.google.com/maps/contrib/115729563512218272075/reviews"
},
{
"relative_time_description": "a month ago",
"rating": 1,
"time": 1476082876,
"author_name": "Wayne Furlong",
"text": "Completely useless. Dishonest, lazy and downright incompetent. Corporate bullies. I'm so much happier with Bigpipe.",
"aspects": [
{
"rating": 0,
"type": "overall"
}
],
"language": "en",
"author_url": "https://www.google.com/maps/contrib/113527219809275504416/reviews"
},
{
"relative_time_description": "3 months ago",
"rating": 1,
"time": 1471292986,
"author_name": "Shaun b",
"text": "Recently upgraded to \"unlimited\" Fibre with Orcon. Most mornings (5-9) we have a limited wired or wireless connection. Too often (as is the case this morning) we have no internet (so while at home we have to use phone data). This is on Wellington's cbd area. Their customer service is such that a reply could take upwards of 4 weeks. I intend to change provider.",
"aspects": [
{
"rating": 0,
"type": "overall"
}
],
"language": "en",
"author_url": "https://www.google.com/maps/contrib/101110905108291593535/reviews"
}
],
"utc_offset": 780,
"adr_address": "<span class=\"street-address\">1 The Strand</span>, <span class=\"extended-address\">Takapuna</span>, <span class=\"locality\">Auckland</span> <span class=\"postal-code\">0622</span>, <span class=\"country-name\">New Zealand</span>",
"photos": [
{
"html_attributions": [
"Orcon"
],
"height": 877,
"photo_reference": "CoQBdwAAAO0RRplNcUkeQUxtJLTNk3uAOTadHfKZQ8g2NMa6XLRmGX2oKdUHItfnKZP0CG2WwIj198PwzfDRJpZIw4M1wSENCEOD9mFjITSwWTMjHkw1PzHb9teT6vuuROxcCdH-fwCYp0tkeBc75R8RHb2drPbTk-NN_5q88jkJTfNwdZQDEhB-25Az9550mGd00B-zK-LRGhQpTusm33tZBFXA1952txiuAUsgQA",
"width": 878
}
],
"id": "a7c161a7081101d8897c2dd2fb41fa94b812b050",
"scope": "GOOGLE",
"vicinity": "1 The Strand, Takapuna, Auckland",
"international_phone_number": "+64 800 131 415",
"url": "https://maps.google.com/?cid=6484891029444838721",
"types": [
"point_of_interest",
"establishment"
],
"name": "Orcon",
"rating": 1.8,
"geometry": {
"viewport": {
"northeast": {
"lat": -36.7889585,
"lng": 174.77310355
},
"southwest": {
"lat": -36.7890697,
"lng": 174.77302975
}
},
"location": {
"lat": -36.78901820000001,
"lng": 174.7730694
}
},
"place_id": "ChIJlc_6_jM4DW0RQUUtaQj2_lk",
"formatted_address": "1 The Strand, Takapuna, Auckland 0622, New Zealand",
"reference": "CmRRAAAAD0loSIVYDAuRKLbv5Cp6ZM_jxKHbzJ7EOrDLakY1PAlmq5YDTJ82A4qzWje0ILFv3lsEdaUpCtkuVHuOxXW6so5yqxDSfkgEnXbzd84jtfItuxis7Izu-y87vwkD7JO4EhBZB6aIdHSchBT6_USM5B5VGhTTRgmnDKndDt6amWnPkXw-57-Pww",
"icon": "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"website": "https://www.orcon.net.nz/",
"formatted_phone_number": "0800 131 415",
"address_components": [
{
"short_name": "1",
"types": [
"street_number"
],
"long_name": "1"
},
{
"short_name": "The Strand",
"types": [
"route"
],
"long_name": "The Strand"
},
{
"short_name": "Takapuna",
"types": [
"sublocality_level_1",
"sublocality",
"political"
],
"long_name": "Takapuna"
},
{
"short_name": "Auckland",
"types": [
"locality",
"political"
],
"long_name": "Auckland"
},
{
"short_name": "Auckland",
"types": [
"administrative_area_level_1",
"political"
],
"long_name": "Auckland"
},
{
"short_name": "NZ",
"types": [
"country",
"political"
],
"long_name": "New Zealand"
},
{
"short_name": "0622",
"types": [
"postal_code"
],
"long_name": "0622"
}
]
},
"status": "OK"
}
json_data_dic.get("result").get("reviews") or json_data_dic['result']['reviews'] gives you the list of reviews
json_data_dic.get("result").get("reviews")[0].get("text") returns the text of the first review
If you need to get each review:
for review in json_data_dic.get("result").get("reviews"):
print review.get("text")
In general, use .get(KEY) or [KEY] access a dictionary item by the key and use
[INDEX] access an item in a list by the index (starting from 0)
I have an object stored in arangodb which has additional inner objects, my current use case requires that I update just one of the elements.
Store Object
{
"status": "Active",
"physicalCode": "99999",
"postalCode": "999999",
"tradingCurrency": "USD",
"taxRate": "14",
"priceVatInclusive": "No",
"type": "eCommerce",
"name": "John and Sons inc",
"description": "John and Sons inc",
"createdDate": "2015-05-25T11:04:14+0200",
"modifiedDate": "2015-05-25T11:04:14+0200",
"physicalAddress": "Corner moon and space 9 station",
"postalAddress": "PO Box 44757553",
"physicalCountry": "Mars Sector 9",
"postalCountry": "Mars Sector 9",
"createdBy": "john.doe",
"modifiedBy": "john.doe",
"users": [
{
"id": "577458630580",
"username": "john.doe"
}
],
"products": [
{
"sellingPrice": "95.00",
"inStock": "10",
"name": "School Shirt Green",
"code": "SKITO2939999995",
"warehouseId": "723468998682"
},
{
"sellingPrice": "95.00",
"inStock": "5",
"name": "School Shirt Red",
"code": "SKITO245454949495",
"warehouseId": "723468998682"
},
{
"sellingPrice": "95.00",
"inStock": "10",
"discount": "5%",
"name": "School Shirt Blue",
"code": "SKITO293949495",
"warehouseId": "723468998682"
}
]
}
I want to change just one of the products stock value
{
"sellingPrice": "95.00",
"inStock": "10",
"discount": "5%",
"name": "School Shirt Blue",
"code": "SKITO293949495",
"warehouseId": "723468998682"
}
Like update store product stock less 1 where store id = x, something to this effect
FOR store IN stores
FILTER store._key == "837108415472"
FOR product IN store.products
FILTER product.code == "SKITO293949495"
UPDATE product WITH { inStock: (product.inStock - 1) } IN store.products
Apart from the above possibly it makes sense to store product as a separate document in collection store_products. I believe in NOSQL that is the best approach to reduce document size.
Found answer
here arangodb-aql-update-single-object-in-embedded-array and there
arangodb-aql-update-for-internal-field-of-object
I however believe it is best to maintain separate documents and rather use joins when retrieving. Updates easily