Parse.com Javascript SDK使用include,但不起作用 [英] Parse.com Javascript SDK using include, but not working

查看:84
本文介绍了Parse.com Javascript SDK使用include,但不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从名为 Book 的表中获取数据。在 Book 里面有一个指针< ParseUser> ,它包含一个用户的指针。 ParseUser 有另一个名为 Pais 的指针(这意味着西班牙语为Country)。所以我想从任何 Book 中获取每一个信息:

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:

为什么?我知道当我在iOS或Android中使用 include(String key) includeKey:NSString * key

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

为什么不能用Javascript工作?

Why doesn't it work with Javascript??

提前谢谢。

问候。

Rafael。

编辑:

哦,我忘记了......我试过了:

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

query.include([user]);

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

我见过一些开发人员使用它的例子。

I've seen some examples where developers used it.

第二次编辑:

我用过的最后一件事是 fetch 喜欢:

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});
                               },
                               });

但也没有用。

这开始吓坏了我。

我们的工作方式:
我们尝试做的解决方法是分别获取所有内容,然后一起返回给用户。这不是一个好习惯,因为未来课程的一点变化会破坏整个功能。

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.

这是SDK中的错误吗?

Is this a bug in the SDK ?

推荐答案

(这是一个评论转化为答案)

只是一个想法,因为我最近遇到的CloudCode与你的问题非常相似。您使用的是哪个版本的JavaScript SDK?我通过将版本更改回1.4.2解决了我的问题。在你的情况下,这只是一个黑暗的镜头,但它可能会工作。

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.

这里是我描述问题的线程以及如何通过更改SDK版本来解决它。

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

这篇关于Parse.com Javascript SDK使用include,但不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆