解析:在查询中包含嵌套指针 [英] Parse: Include nested pointers in query

查看:59
本文介绍了解析:在查询中包含嵌套指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有以下结构:

I have the following structure in my app:

MessageRecipients -> Message -> User 
                     Message -> Activity

其中 - >表示指针。我已经分离出邮件和邮件收件人表,因为我需要捕获每个收件人是否已读取邮件。

where the -> represent a pointer. I have separated out the messages and message recipients tables because I need to capture whether the message has been read by each recipient.

我想要查询的是查找收件人的所有邮件。所以我需要在MessageRecipients查询中包含该消息,但我还想包括嵌套的User和Activity对象。

The query I want to do is find all of the messages for a recipient. So I need to include the message in the MessageRecipients query but I would also like to include the nested User and Activity objects.

var MessageRecipient = new Parse.Query('MessageRecipient');
messageQuery.equalTo('recipient', query.recipient);
messageQuery.include('message');

邮件回来时没有填充活动和发件人。我尝试调用messageQuery.include('activity'),但由于活动不在正确的表上,因此无效。

The message comes back without the activity and sender populated. I tried calling messageQuery.include('activity') but that didn't work as activity is not on the correct table.

有没有办法进行此查询,还是必须对嵌套对象进行单独查询?

Is there a way to do this query or do you have to do separate queries for the nested objects?

推荐答案

您还需要包含这些子子对象:

You'll need to include those sub-sub-objects as well:

messageQuery.include('message');
messageQuery.include('message.user');  // if user is the column name
messageQuery.include('message.activity'); // if activity is the column name

这篇关于解析:在查询中包含嵌套指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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