查看未编入索引的数据存储区字段
Looking at datastore field that is not indexed
我有一个已编入索引的 id
字段和一个未编入索引的布尔字段 x
。有什么方法可以查看所有 x 设置为 true 的实体 而没有 以下内容?
- 有一组 id 可以作为过滤依据
- 逐页滚动 UI
很遗憾,没有。 Cloud Datastore 需要一个索引来查询 属性。您可以编写脚本来生成 ID 列表。例如,在 python:
from google.cloud import datastore
client = datastore.Client()
query = client.query(kind='foo')
results = list(query.fetch())
for i in results:
if i['x'] == True:
print('Entity {} with id {} has x = True'.format(i.key, i['id']))
我有一个已编入索引的 id
字段和一个未编入索引的布尔字段 x
。有什么方法可以查看所有 x 设置为 true 的实体 而没有 以下内容?
- 有一组 id 可以作为过滤依据
- 逐页滚动 UI
很遗憾,没有。 Cloud Datastore 需要一个索引来查询 属性。您可以编写脚本来生成 ID 列表。例如,在 python:
from google.cloud import datastore
client = datastore.Client()
query = client.query(kind='foo')
results = list(query.fetch())
for i in results:
if i['x'] == True:
print('Entity {} with id {} has x = True'.format(i.key, i['id']))