解析:如果我将它与指针类型一起使用,“containedIn”将不返回任何内容

Posted

技术标签:

【中文标题】解析:如果我将它与指针类型一起使用,“containedIn”将不返回任何内容【英文标题】:Parse: "containedIn" returns nothing if I used it with pointer type 【发布时间】:2021-09-15 01:07:34 【问题描述】:

如果我尝试使用containedIn 过滤数据,如下所示,我将得到空结果,因为我试图从指针列类型userProfile 过滤,尽管我在查询中包含userProfile

但是,我尝试将containedIn 直接用于User 中的另一个数组列,并且似乎工作正常。这种下面的查询不起作用吗?什么是替代解决方案?

const query = new Parse.Query('User');
query.equalTo('accountType', 'Student');
query.include('userProfile');

// search.subjects is an array
query.containedIn('userProfile.subjectsIds', search.subjects);

【问题讨论】:

【参考方案1】:

很遗憾,您不能对包含的对象执行 containsIn()。要使 containsIn() 工作,它必须在您查询的类的列上执行。

换句话说,您必须直接在 userProfile 类上执行此查询,containedIn() 才能工作

【讨论】:

以上是关于解析:如果我将它与指针类型一起使用,“containedIn”将不返回任何内容的主要内容,如果未能解决你的问题,请参考以下文章