5

I'm trying to fetch data from a table called Book. Inside Book there's a Pointer<ParseUser> which holds the pointer of one user. The ParseUser has another pointer called Pais (which means Country in spanish). So I want to fetch every single info from any Book:

var query = new Parse.Query("Book");
query.include("user");
query.include("user.pais");
query.find({
success: function(books) {
      response.success(books);
},
error: function(error) {
  response.error({'resp': error.code, 'message': error.message});
}
});

and I don't get the objects, just the pointers:

enter image description here

Why ? I know it works ok when I call it in iOS or Android with include(String key) or includeKey: NSString* key.

Why doesn't it work with Javascript??

Thank you in advance.

Regards.

Rafael.


EDIT:

Oh and I just forgot... I've tried with:

query.include(["user"]);

and

query.include(["user", "user.pais"]);

I've seen some examples where developers used it.


SECOND EDIT:

The last thing I've used is fetch like:

Parse.Object.fetchAll(books, {
                               success: function(list) {
                                     response.success(list);
                               },
                               error: function(error2) {
                                     response.error({'resp': error2.code, 'message': error2.message});
                               },
                               });

But didn't work either.

This is starting to freak me out.


OUR WORKAROUND: The workaround we're trying to do is fetching everything separately, and then returning back to the user together. This is not a good practice since a little change in the class in a future would ruin the whole function.

Is this a bug in the SDK ?

Rafael Ruiz Muñoz
  • 5,333
  • 6
  • 46
  • 92
  • IMO the include may not be transitive in the way you want it to be. If the pointers are ALL in the table that is the parent or the target of the query, includes on the list[pointers] will work – Robert Rowntree Oct 11 '15 at 14:45
  • So how can I fetch them as I do in Android SDK or iOS SDK? – Rafael Ruiz Muñoz Oct 11 '15 at 16:26
  • Just a thought because I recently had a problem with CloudCode that is quite similar to yours. What version of the JavaScript SDK are you using? I solved [my problem](http://stackoverflow.com/a/32705381/4988014) by changing the version back to 1.4.2. It's just a shot in the dark in your case, but it might work. – eschanet Oct 13 '15 at 16:31
  • Hi @EricSchanet, definitely it works with Parse JS SDK 1.4.2 a not with the latest. Please could you convert your comment in answer and I'll give you the bounty? thank you very much for solving this. – Rafael Ruiz Muñoz Oct 13 '15 at 17:44

1 Answers1

1

(This is a comment turned into an answer)

Just a thought because I recently had a problem with CloudCode that is quite similar to yours. What version of the JavaScript SDK are you using? I solved my problem by changing the version back to 1.4.2. It's just a shot in the dark in your case, but it might work.

Here is the thread where I described the problem and how to solve it by changing the SDK version.

Community
  • 1
  • 1
eschanet
  • 1,063
  • 6
  • 15