Query Issue

On App #717EA037-49BD-FA51-FF0D-720176385200, we have created two tables: quotes and ratings with a relation of 1 quote to N ratings.

For instance quoteId(8287) has 5 ratings attached to it.

However, when we query this same quote through the following code, it returns no rating whatsoever.

const quotesStorage = Backendless.Persistence.of(quotes);
      const query = new Backendless.DataQuery();
      query.condition = 'id = 8287';
      return quotesStorage.find(query).then(result => {
       // return result.data[0].ratings;
       return result;

This is the response we are getting

  "offset": 0,
  "data": [
      "___jsonclass": "quotes",
      "Permalink": "https://healthruwords.com/inspirational-pictures/detachment/",
      "Category_2": "",
      "publishDate": "20150712",
      "Category_1": "DailyBoost>DailyBoost Year 1",
      "ownerId": null,
      "enclosure": "",
      "ratings": [],
      "Excerpt": "Past, present, and future are one. Who I am today creates my future out of attachment to my past. If I change my now moment, I create a different future, ending so, the repetition of my past based on the obsolete conditioning. ~ Roxana Jones #quotes #inspirationalquotes\n",
      "___class": "quotes",
      "ExpandedQuote": "It is shocking to see so much people on this planet dedicating their lives to criticize all that goes on around them. They are experts at judging everything and everyone. It is as if they have closed themselves to the possibility of understanding that by doing so, they are responsible for creating more of that which they are criticizing so ardently. Are you one of the few who really wants to bring positive change to your life? Are you feeling that you are ready to break free from that vicious cycle that is not taking society anywhere? If your answer is yes, three things you must focus your attention on: 1. Heal and forgive your relation with your past. 2. Accept and integrate the belief that you and your relation with the now moment is the top priority in your life. 3. Work constantly at visualizing and bringing your ideal future into your present. Take small steps every day toward these three goals. Detach from your past and be patient with the process. This always works so don’t doubt, simply go for it.",
      "id": 8287,
      "objectId": "041BB318-7C7C-3E69-FF30-F9340CA79C00",
      "Tag_2": "Courage",
      "Order": 527,
      "Tag_1": "Change",
      "Tag_4": "",
      "ratings_average": 0,
      "Tag_3": "Forgiveness",
      "created": 1478484799000,
      "ratings_users": 0,
      "Title": "Detachment",
      "Slug": "detachment",
      "featured_image": "https://healthruwords.com/wp-content/uploads/2015/06/Healthruwords.com_-_Inspirational_Images_-_Dettachment.jpg",
      "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"Permalink\",\"Category_2\",\"publishDate\",\"Category_1\",\"ownerId\",\"enclosure\",\"ratings\",\"Excerpt\",\"ExpandedQuote\",\"___class\",\"id\",\"objectId\",\"Tag_2\",\"Order\",\"Tag_1\",\"Tag_4\",\"ratings_average\",\"Tag_3\",\"created\",\"ratings_users\",\"Title\",\"Slug\",\"featured_image\",\"Author\",\"ratings_score\",\"updated\"],\"relatedObjects\":{}}",
      "Author": "Roxana Jones",
      "ratings_score": 0,
      "updated": 1483467525000
  "nextPage": null,
  "totalObjects": 1

What are we doing wrong?

Are you asking why you’re not getting any ratings with the returned quote?

yes :slight_smile:

there are couple options to load relation. please check documentation https://backendless.com/documentation/data/js/data_relations_retrieve.htm