久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

從 Firebase 實時數據庫 Android 查詢嵌套數據

Query nested data from Firebase Real-time database Android(從 Firebase 實時數據庫 Android 查詢嵌套數據)
本文介紹了從 Firebase 實時數據庫 Android 查詢嵌套數據的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有下圖中的結構,我想從id_Usuario"查詢的節點aaa1234"中獲取全部數據.我該怎么做這個查詢?

I have the structure in the image below and I want to get the whole data from the node "aaa1234" querying by "id_Usuario". How can I do that query?

我試過了:

DatabaseReference root = database.getReference().child("Eventos").child("participantes");
Query query = root.orderByChild("id_Usuario").equalTo(2);

為了更清楚一點,aaa1234"是自定義鍵,所以在下一個節點會有所不同.

Just to be more clear, the "aaa1234" is a custom key, so it will be different in the next node.

推薦答案

我看到了兩個錯誤.

第一個是錯字,我已經在評論中標明了.您將用戶 ID 存儲為數字,因此不應該在 equalTo 中的值周圍加上引號.所以:.equalTo(2)

The first one is a typo, which I already marked in my comment. You're storing the user ID as a number, so shouldn't have quotes around the value in equalTo. So: .equalTo(2)

第二個錯誤是你嘗試查詢的方式:

The second mistake is in the way you try to query:

DatabaseReference root = database.getReference().child("Eventos").child("participantes");

這將創建對不存在的子 Eventos/participantes 的引用.你想要做的是查詢 Eventos,然后查詢屬性 participantes/id_Usuario.所以

This will create a reference to the non-existing child Eventos/participantes. What you want to do instead is query Eventos, but then against property participantes/id_Usuario. So

DatabaseReference root = database.getReference().child("Eventos");
Query query = root.orderByChild("participantes/id_Usuario").equalTo(2);

這篇關于從 Firebase 實時數據庫 Android 查詢嵌套數據的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現 IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 91视频91| 亚洲一区二区三区在线播放 | 波多野结衣中文视频 | 国产精品网址 | 精品在线观看入口 | 天天操天天操 | 免费黄色在线观看 | 作爱视频免费看 | 日韩成人久久 | 久久久久久国产精品免费免费男同 | 一区二区三区视频播放 | 羞羞网站免费观看 | 亚州中文| 亚洲高清在线免费观看 | 天天天操天天天干 | 久久狠狠| 在线国产中文字幕 | 在线观看视频91 | 欧美一级视频在线观看 | 亚洲一区二区久久 | 久久国产精品亚洲 | 一区二区免费看 | 鲁一鲁资源影视 | 欧美在线观看一区 | 国产在线视频一区 | 欧美日韩一区二区在线播放 | 欧美a区 | 国产成人a亚洲精品 | 欧美va大片| 久久中文字幕一区 | 久久久久久一区 | 国产成人网 | 欧美极品在线视频 | 水蜜桃亚洲一二三四在线 | 高清av电影 | 五月天激情电影 | 欧美黑人狂野猛交老妇 | 91精品久久久久久久久久 | 久久久久亚洲 | 99精品久久 | 国产情侣啪啪 |