A Restaurant has a location, many comments, max of 3 tags, and an owner who has a reputation.
I am basically displaying a feed of data to users based on their location. Is there a way I can get all restaurants around me with each restaurant having all the 3 tags, Count(comments), the owner information and the owner reputation ?
Can this be done in one query ? and if not then how are cases like that handled ( think social media feed where for every row you need to pull information from different tables)?
Hi Mark,
Thank you. So I need to do these over multiple queries then, right? Basically I need to find restaurants through search by distance. Then loop through each restraurant and send a seperate request to get Tags, commend and owner information. Is this correct? Theoritically this would work but wouldn’t it take long time compared to one query ? I was hoping there is q eury that can get relations of relations based on geo
You probably can do that by specifying count(comments.objectId) as commentsCount as one of the properties field of the query (or props query parameter if you use REST API). This way you’ll receive a field commentsCount for each Restaurant object containing a number of Comments related.