ios - 应用过滤器和排序同一时间的firebase
<p><div>
<aside class="s-notice s-notice__info post-notice js-post-notice mb16"role="status">
<div class="d-flex fd-column fw-nowrap">
<div class="d-flex fw-nowrap">
<div class="flex--item wmn0 fl1 lh-lg">
<div class="flex--item fl1 lh-lg">
<b>这个问题在这里已经有了答案</b>:
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>如果您在大多数情况下需要访问这些项目,这将是每个用户,您可以更改您的数据模型:</p>
<pre><code>{
"user816": {
"-KZVOY6qU29fJlRSwRNo" : {
"fedStateDetails" : "Fasted",
"targetkcal" : 596,
"timestamp" : 1.482307285673975E9,
"workout_id" : "123"
}
},
"user47": {
"-KZVSmeW94XetROs0nsN" : {
"fedStateDetails" : "Fasted",
"targetkcal" : 1874,
"timestamp" : 1.482308270356936E9,
"workout_id" : "129"
},
"-KZWGdx-j1q7J37x0wck" : {
"fedStateDetails" : "Fasted",
"targetkcal" : 0,
"timestamp" : 1.482321866382767E9,
"workout_id" : "40"
}
}
}
</code></pre>
<p>现在您可以使用 <code>child()</code> 访问特定用户的数据,然后使用 <code>queryOrder(byChild:"timestamp")</code> 按时间戳对它们进行排序。</p>
<p>我推荐:</p>
<ul>
<li>阅读 <a href="https://highlyscalable.wordpress.com/2012/03/01/nosql-data-modeling-techniques/" rel="noreferrer noopener nofollow">NoSQL data modeling</a> </li>
<li>查看<a href="https://www.youtube.com/playlist?list=PLl-K7zZEsYLlP-k-RKFa7RyNPa9_wCH2s" rel="noreferrer noopener nofollow">Firebase for SQL developers</a> </li>
<li>研究我的答案 <a href="https://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase" rel="noreferrer noopener nofollow">Query based on multiple where clauses in firebase</a> </li>
</ul></p>
<p style="font-size: 20px;">关于ios - 应用过滤器和排序同一时间的firebase,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/41740178/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/41740178/
</a>
</p>
页:
[1]