Parse.com Javascript SDK using include, but not working

≡放荡痞女 提交于 2019-12-07 05:16:26

问题


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:

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 ?


回答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.



来源:https://stackoverflow.com/questions/33059768/parse-com-javascript-sdk-using-include-but-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!