0

在我的谷歌应用程序中,我有实体public String[] UserRoles;字段。如何获取此列表中包含特定字符串的记录?

我的意思是,我想写一些类似的东西

ofy().load().type(ExampleEntity.class).filter("UserRoles contains", "foo").list()

可能吗?

4

1 回答 1

1

数据存储区中的过滤对于集合属性具有特殊意义:

ofy().load().type(ExampleEntity.class).filter("UserRoles", "foo")

这意味着在 UserRoles 集合中加载具有“foo”作为值的记录(请注意,Java 中的字段以大写字母开头是不好的形式)。

确保您 @Index 该字段并且您的查询应该有效。

于 2013-10-17T05:39:38.737 回答