I want to query a whole table (posts_meta) with its relation (column post_data) and filter some of the results based on attributes of the post_data. I try filtering the results with the where clause unfortunately the filters which refer to the relation do not seem to apply.
- A single query against the database joining retrieving the data
- which has applied the where clause filters to the results
- a Behave similar to SQL
const queryBuilder = Backendless.DataQueryBuilder.create(); queryBuilder.setRelated("post_data") queryBuilder.setSortBy(["posted_date"]) queryBuilder.setWhereClause("post_data.lang = 'en' AND post_data.post_type='published'") const PAGE_SIZE = 100 let offset = 0 queryBuilder.setPageSize(PAGE_SIZE) queryBuilder.setOffset(offset) const postsDB = Backendless.Data.of('posts_meta'); console.log("Fetching posts...") postsDB.find(queryBuilder).then(log_success).catch(log_error)
Instead of a flat list with all the values what I get is a list of the posts_meta objects which contain all the relations in the column field post_data (a nested object) with all related objects rather than the filtered ones.
I read all the documentation but it only speaks about doing multiple queries to filter the subqueries and then joining the data in the client code using multiple transactions for each ObjectID of the parent table which I wish I wouldn’t have to do for many many reasons.
I thought we were having a SQL database.