Support Topics Documentation Slack YouTube Blog

Why I am not getting the full row


(SnakeEyes) #1

Hello
I am running the query below

DataQueryBuilder queryBuilder = DataQueryBuilder.create();
String query = new String("");
query+=" my custom query " ;
queryBuilder.setWhereClause(query);
queryBuilder.addProperty(“Count(likedBy) as likes”);
queryBuilder.addProperty(“Count(disLikedBy) as dislikes”);
queryBuilder.setSortBy(“created ;DESC”);
queryBuilder.setRelated(“postedBy”,“location”,“title”);
queryBuilder.setPageSize(100).setOffset(paging_offset);
List<Map> results = Backendless.Data.of( “Posts” ).find( queryBuilder );

I am only getting few fields (the related and properties above). I thought I would be getting all Posts table column. Am I missing something?
Thank you


(Sergey Chupov) #2

When you set the properties (which you do by calling .addProperty(...)) you will only get those properties in response. Once you specify at least one property (even if it’s an aggregate), you have to specify all of those you’d like to retrieve.