My goal is to get the most recent review for each book by a given author. I would prefer not to have client side logic.
I am open to using related tables to denormalized table.
Author
Book
Review
For example, an Author has 3 books and each book has 3 reviews.
I want to get the most recent review for each book based on a given author (I am only querying for one author).
I have achieved this with SQL query but trying to figure out using backendless query.
Since the data aggregation is not implemented in Backendless, the data retrieval should look like this
- retrieve all author’s books (one query)
- for each book, retrieve the most recent review (one query per book which includes sort option and the pageSize equals 1)
If you don’t want to have this logic on the client, you can move it to the server using Backendless Custom Business Logic system
This way it will work much faster since the code will be executed much closer to the database.
Specifically to your needs you may implement this logic as a custom API Service
or as a custom event handler
Here is an example of custom event handler
The Custom Business Logic can be written on Java, JS or PHP languages
To summarize, with the Custom Business Logic, the client will only need to make just a single query in order to get all the information