获取实体的批处理操作如下:
一批得到。实体 = db.get([k1, k2, k3])
如何在不提供密钥的情况下获取所有实体?
获取实体的批处理操作如下:
如何在不提供密钥的情况下获取所有实体?
我对此有一个解决方案,可以在 Datastore Queries - Query interface example中找到:
Query q = new Query("Person")
PreparedQuery pq = datastore.prepare(q);
for (Entity result : pq.asIterable()) {
String firstName = (String) result.getProperty("firstName");
String lastName = (String) result.getProperty("lastName");
Long height = (Long) result.getProperty("height");
System.out.println(lastName + " " + firstName + ", " + height.toString() + "inches tall");
}
我没有在查询中添加过滤器,因为它从数据存储区返回所有实体。