2016-07-29 92 views
0

我有一个Field类,它有一个指向它的“Father”类的Venue,Venue有一个Location列,我想作一个查询,只带来30英里以内的Fields。如何在Parsing whereWithinMiles函数中使用关系数据?

query.whereWithinMiles("venueId.Location", userLocation, 30); 

我敢肯定,错就错在venueId.Location,但我不知道如何让我的指针的位置列的值。

venueId是指针。 位置是我想要比较的指针列。 userLocation是用户当前位置。

感谢您的阅读。

回答

2

点符号不支持查询的位置,但仅限于包含。 如果你喜欢做它,你将需要与编写查询** ** whereMatchesKeyInQuery

所以在你情况下,应该寻找类似的东西(根据你的等级改变数值):

ParseQuery query = new ParseQuery.getQuery("ParentClass"); // change the class name 
ParseGeoPoint point = new ParseGeoPoint(40.712784,-74.005941); // put your location here 
query.whereWithinMiles("location",point,30); 

ParseQuery venueQuery = new ParseQuery.getQuery("SubClass"); // change the class name 
venueQuery.whereMatchesKeyInQuery("venueId","objectId",query); 
venueQuery.findInBackground(new FindCallback() { 
    @Override 
    public void done(List objects, ParseException e) { 

    } 

    @Override 
    public void done(Object o, Throwable throwable) { 

    } 
});