[英]Parse relational query on multiple geopoint
I'm using Parse.com as a backend to my app project. 我将Parse.com用作我的应用程序项目的后端。 I have two classes
Deal
and Outlets
. 我有两个班次
Deal
和Outlets
。 They are linked to each other via an array. 它们通过数组相互链接。
Deal
and Outlets
have a one to many relationship as every deal can have multiple outlets. Deal
和Outlets
具有一对多的关系,因为每笔交易都可以有多个网点。 Hence,the geopoint information is kept in each outlet record. 因此,地理位置信息保存在每个出口记录中。
I want to query the deal that is nearest to me within 5km. 我想查询距离我最近的5公里之内的交易。 Is there a way for me to include/join the geopoint before calling the query?
在调用查询之前,有没有办法让我包含/加入Geopoint? So far, the "includeKey" functions only does makes the result include the "outlets".
到目前为止,“ includeKey”功能仅确实使结果包括“出口”。 But I need to include/join it before calling the geo query.
但是我需要在调用地理查询之前包含/加入它。
Can anyone help me with this? 谁能帮我这个? Thanks so much.
非常感谢。
Maybe because your Geo points are stored in your Outlet
class, you do not want to run your Geo query on the Deal
object but on the Outlet
object. 也许因为地理位置是存储在
Outlet
类中的,所以您不想在Deal
对象上而是在Outlet
对象上运行Geo查询。 If we assume that an Outlet
is offering a Deal
, then any Outlet
record can simply point to a Deal
it is offering. 如果我们假设某个
Outlet
正在提供Deal
,则任何Outlet
记录都可以简单地指向它正在提供的Deal
。 Now simply perform a Geo query to find the nearest Outlet
to you and then you easily get the associated Deal
via the pointer. 现在,只需执行地理位置查询即可找到离您最近的
Outlet
,然后您就可以通过指针轻松获得关联的Deal
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.