Querying relations

I have tried following the documentation for relational data up until the point where i try to query the relations, and when i try to console.log(list) nothing happens? here is a code snippet:

      relation.query().find({
        success: function (list) {
          // list contains the posts that the current user likes.
          console.log(list);
        }
      });

all other code is exactly as per documentation (https://docs.moralis.io/objects#relational-data) so i dont want to repeat it here.
I would have expected the console.log(list) to return an object with all the relations in it, but literally nothing shows up on the console.
Would be good to get some help on this as im trying to query all posts that were created by a user.
Im using a work around at the moment where every post created points to the post creator, but it seems relational data should be able to do this as well so id prefer to do it the relational data way.
but if not ill can just keep doing it the way im currently doing it.

any help would be appreciated. thanks.

Thanks for reporting. After some testing I don’t think relational queries are working. Either with the bogus “success” callback or with promises. This bug will be added to our backlog.

While this is what the docs say… the docs are based on the Parse docs, which I think are incorrect in this case. relation.query() returns a regular Moralis.Query object. If you look at the Parse API docs for query.find() the there is no success callback function defined on the options param:

http://parseplatform.org/Parse-SDK-JS/api/3.2.0/Parse.Query.html#find

query.find() returns a Promise. Try the following… or use async and await.

relation.query().find().then(function (list) {
  console.log(list);
})

This didn’t seem to work for me either, though. If you get it to work let us know.

EDIT: created an issue for this on our tracker here.

hi Jeremy, thanks for your response.

yes I did go through the Parse docs but they are pretty much identical to Moralis docs.

the object query method does not work for me either at the time of writing.

I will continue using my work around for the time being.