【发布时间】:2016-08-26 14:33:53
【问题描述】:
这是我目前在 Firebase 上的数据设计(数据只是“事件”参考中的 json 列表)。字段时间戳、操作和持续时间是固定的,以后可能会添加更多可选字段。
backend-7f34e
events
-KQ30Lc6lasdfasdfAi1URf
action: "Get ready"
duration: 100
timestamp: 1472167504389
-KQ30MM8Fgasdf_o10TW
action: "Run"
duration: 1890
timestamp: 1472167507411
我需要能够从时间戳范围 [开始,结束] 中检索数据。我需要使用时间戳作为键吗?结构化数据的更好方法是什么?
【问题讨论】:
-
可以使用
orderByChild("timestamp")查询当前结构。请参阅firebase.google.com/docs/database/android/…(适用于 Android)或您使用的技术的文档。
标签: firebase firebase-realtime-database