我有一个包含日期对象的文档。
初始化 Firestore 的代码:
FirebaseFirestore fireStore = FirebaseFirestore.getInstance();
FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
.setTimestampsInSnapshotsEnabled(true)
.build();
fireStore.setFirestoreSettings(settings);
firestore = fireStore;
查询代码:
FirebaseFirestore db = FireStoreUtils.getInstance();
Query query= db.collection(viewType.collectionName());
query.whereLessThan("endDate", new Date());
return query.orderBy(viewType.sortProperty()).limit(PAGE_SIZE);
我总是得到所有的记录,看起来 where 子句没有得到应用。在 Firebase 控制台上,我看到endDate存储为时间戳。
来自 Firebase 控制台的文档:
createdDate: null (null)
description: "desc" (string)
endDate: February 3, 2019 at 11:18:58 PM UTC-8 (timestamp)
id: "-7475596197450085332" (string)
title: "title"
隔江千里
GCT1015
相关分类