如何在Firebase Database中仅获取更新时间戳的指定单节点?
Firebase Realtime Database 查询问题
数据库结构
我的数据库结构如下:
path1 > uid0 > node > uid1 > node > uid2 > node
其中node包含一个值为ServerValue.TIMESTAMP的timestamp字段。
现有可用查询
- 获取所有
timestamp > pastCutOff的节点:
FirebaseDatabase.getInstance().getReference().child("path1") .orderByChild("timestamp").startAfter(pastCutOff).limitToLast(limit);
- 通过已知UID获取单个指定节点:
FirebaseDatabase.getInstance().getReference().child("path1") .child(uid);
问题与尝试
我希望仅在timestamp更新时才获取该指定单节点以节省带宽,但尝试以下查询无返回结果:
FirebaseDatabase.getInstance().getReference().child("path1") .child(uid).orderByChild("timestamp").startAfter(pastCutOff);
另一种查询逻辑有效,但仅返回timestamp的long类型值而非完整节点:
FirebaseDatabase.getInstance().getReference().child("path1") .child(uid).orderByValue().startAfter(pastCutOff, "timestamp");
提问
是否存在无需创建持久化valueEventListener的可行查询方式?
内容的提问来源于stack exchange,提问作者Simon Huckett
相关产品推荐
相关产品推荐

