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 ?

4
  • 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 Commented Oct 11, 2015 at 14:45
  • So how can I fetch them as I do in Android SDK or iOS SDK? Commented Oct 11, 2015 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 by changing the version back to 1.4.2. It's just a shot in the dark in your case, but it might work. Commented Oct 13, 2015 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. Commented Oct 13, 2015 at 17:44

1 Answer 1

1
+50

(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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.