Google 相同 属性 的多个值的数据存储查询过滤器
Google Datastore query filter for multiple values for same property
我想在 google 数据存储上 运行 查询,该查询旨在从多个设备检索数据。但是,我在文档中找不到任何地方可以让我从例如获取数据。 device-1 或 device-2 或 device-3,即只能设置 1 属性 个名称。这是数据存储限制吗?还是我只是遗漏了一些我不知道的东西?
基于 NodeJS 客户端库,查询可能类似于以下过滤条件:
var query = datastore.createQuery('data')
.filter('device_id', 1)
.filter('device_id', 2)
.filter('device_id', 3);
否则,我可能不得不 运行 为各种设备单独查询,这似乎不是一个非常优雅的解决方案,特别是如果有很多设备同时 运行 查询上。
欢迎对数据存储提出任何建议 API 或其他方法!
是的,这将是一个 OR
操作,它是 Restrictions on queries(强调我的)之一:
The nature of the index query mechanism imposes certain restrictions
on what a query can do. Cloud Datastore queries do not support
substring matches, case-insensitive matches, or so-called full-text
search. The NOT
, OR
, and !=
operators are not natively
supported, but some client libraries may add support on top of Cloud
Datastore. Additionally:
我想在 google 数据存储上 运行 查询,该查询旨在从多个设备检索数据。但是,我在文档中找不到任何地方可以让我从例如获取数据。 device-1 或 device-2 或 device-3,即只能设置 1 属性 个名称。这是数据存储限制吗?还是我只是遗漏了一些我不知道的东西?
基于 NodeJS 客户端库,查询可能类似于以下过滤条件:
var query = datastore.createQuery('data')
.filter('device_id', 1)
.filter('device_id', 2)
.filter('device_id', 3);
否则,我可能不得不 运行 为各种设备单独查询,这似乎不是一个非常优雅的解决方案,特别是如果有很多设备同时 运行 查询上。
欢迎对数据存储提出任何建议 API 或其他方法!
是的,这将是一个 OR
操作,它是 Restrictions on queries(强调我的)之一:
The nature of the index query mechanism imposes certain restrictions on what a query can do. Cloud Datastore queries do not support substring matches, case-insensitive matches, or so-called full-text search. The
NOT
,OR
, and!=
operators are not natively supported, but some client libraries may add support on top of Cloud Datastore. Additionally: