Parse.com嵌套查询包含doesNotMatchQuery

时间:2015-11-02 08:10:44

标签: android ios parse-platform pfuser

我有Disk Out of Space User Class with parse。

我在GroupMember类中添加了一个User指针列,希望从GroupMember类中获取所有用户,但不包括User类关系中存在的用户。< / p>

1 个答案:

答案 0 :(得分:1)

您需要进行两个查询,从objectId指针列查询所有用户GroupMember,然后从User类的下一个查询中排除这些对象。

ParseQuery<ParseObject> a = ParseQuery.getQuery("GroupMember");
a.include("name of pointer column")
a.findInBackground(new FindCallback...); // get list of objects id with for each loop 
//i.e. for (ParseObject o : list) String s = o.getParseObject("user_pointer_column").getObjectId(); 
//then add it to some list

ParseQuery<ParseObject> b = ParseQuery.getQuery("User");
b.whereNotContainedIn("objectId", list_of_ids);

或者另一种方式:

ParseQuery<ParseObject> a = ParseQuery.getQuery("User");   
ParseQuery<ParseObject> b = ParseQuery.getQuery("GroupMember");
b.whereDoesNotMatchQuery("user_pointer_column", a);
b.findInBackground(new FindCallback...{...});