0

我想在 BackAnd 中过滤一个空外键或对象关系的集合。

filter = [ 
  {
    "fieldName": "Parent",
    "operator": "empty",    
    "value": ""
  }
]

这是我的表/对象定义:

{
  "name": "Tree",
  "fields": {
    "Title": {
      "type": "string"
    },
    "Description": {
      "type": "string"
    },
    "Parent": {
      "object": "Certifications"
    },
    "Children": {
      "collection": "Certifications",
      "via": "Parent"
    }
  }
}

当我尝试上面的过滤器时,我收到了这个错误:

The field "FK_Tree_Tree_Parent" is a relation field. 
To filter relation fields please use the operator "in"

这只是返回表中的所有值:

filter = [ 
  {
    "fieldName": "Parent",
    "operator": "in",    
    "value": ""
  }
]

是否可以取回没有分配父母的记录?

4

1 回答 1

0

您可以使用Queries,使用以下 sql

SELECT * FROM Tree WHERE Parent IS NULL 
于 2016-05-11T10:51:11.057 回答