[英]How to get full details from Firebase database using rest client Api
I have a firebase database that looks like below我有一个 firebase 数据库,如下所示
I am using rest-client API to get data from the firebase in Unity c#. I know how to call one user at a time using rest-client API.我正在使用 rest-client API 从 Unity c# 中的 firebase 获取数据。我知道如何使用 rest-client API 一次呼叫一个用户。
RestClient.Get<User>(databaseURL + "/" + getLocalId + ".json?auth=" + idToken).Then(response =>
{
});
But I want to know how to call/download all users using one request, but also avoiding one column, that is Project column as shown in the below picture.但我想知道如何使用一个请求调用/下载所有用户,同时避免一列,即 Project 列,如下图所示。 How to do this这该怎么做
First, I would recommend you use the unity SDK as its better for performance and usage optimization check firebase documentation on this matter here首先,我建议您使用 unity SDK,因为它更适合性能和使用优化,请在此处查看有关此问题的 firebase 文档
https://firebase.google.com/docs/database/usage/optimize#open-connections
as for your question when you get data from parent level you get its children nodes with it so when you get the data at path users you will get all the users data under it but if you get the data at users/uid path you get that specific user (node) only so you can't really get all users without getting the projects of each user too as the projects are a child node至于你的问题,当你从父级别获取数据时,你会得到它的子节点,所以当你在路径 users 获取数据时,你将获取它下面的所有用户数据,但是如果你在 users/uid 路径获取数据,你会得到仅限特定用户(节点),因此如果不获取每个用户的项目就无法真正获取所有用户,因为项目是子节点
a workaround could be having two different data paths the one you already have users/uid/data but without including the projects list under users the second one projects/uid/data this way when you pull users data you will not get projects data as it does not contain it and if you want projects list of certain user you can still get by the user id just from different path projects/uid instead of users/uid一个解决方法可能是有两个不同的数据路径,一个你已经有 users/uid/data 但不包括用户下的项目列表,第二个 projects/uid/data 这样当你拉用户数据时你不会得到项目数据不包含它,如果你想要某个用户的项目列表,你仍然可以通过不同路径 projects/uid 而不是 users/uid 获取用户 id
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.