查询Parse Sdk Android

时间:2017-02-04 02:05:38

标签: parse-android-sdk

我有一个Favorite类,它有一个名为Location的类的指针作为其位置字段之一。我想查询Favorite类并检索指向某个Location对象的所有对象。在javascript中我只创建一个Location对象,将id设置为我感兴趣的位置的objectId,并查询Favorite,其中location与该对象相等。

但是在android中我无法设置objectId。另外,只将查询设置为objctId的字符串不起作用。

// Something I would have expected existed
//ParseObject location = new ParseObject("Location");
//location.setObjectId(locationId);

final ParseQuery<ParseObject> query = ParseQuery.getQuery("Favorite");
// if I had the location object, but I only have the locationId
//query.whereEqualTo("location", location );

query.whereEqualTo("location", locationId);
query.findInBackground(...

1 个答案:

答案 0 :(得分:0)

query.whereEqualTo("location",Parse.createWithoutData(reference_classname,ObjectId));