【发布时间】:2022-09-27 21:19:27
【问题描述】:
基本上我对使用以下代码获得的读取量有疑问:
public Iterable<Contract> findAllExpired(){
List<Contract> empList = new ArrayList<Contract>();
CollectionReference collaborator = fb.getFirestore().collection(\"Contracts\");
ApiFuture<QuerySnapshot> querySnapshot = collaborator.get();
try {
for (DocumentSnapshot doc : querySnapshot.get().getDocuments()) {
Contract emp = doc.toObject(Contract.class);
if (emp.isExpired()) {
empList.add(emp);
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
}
目前我的数据库中有 30 个文档,有没有一种方法可以检索这些文档而不会导致 Firestore 将查询计为 30 次读取但仅计为一次?
标签: java google-cloud-firestore