firebase-realtime-database

Indexing unknown nodes in Firebase

梦想与她 提交于 2020-07-23 15:18:02
问题 My data structure is like this: firebase-endpoint/updates/<location_id>/<update_id> each location has many updates that firebase adds as "array" elements. How can I index on the "validFrom" property of each update if the location_id is unknown before insertion into the databse? { "rules": { "updates": { "<location_id>": { // WHAT IS THIS NODE SUPPOSED TO BE? ".indexOn": ["validFrom"] } } } } data structure sample { "71a57e17cbfd0f524680221b9896d88c5ab400b3": { "-KBHwULMDZ4EL_B48-if": { "place

Indexing unknown nodes in Firebase

懵懂的女人 提交于 2020-07-23 15:15:01
问题 My data structure is like this: firebase-endpoint/updates/<location_id>/<update_id> each location has many updates that firebase adds as "array" elements. How can I index on the "validFrom" property of each update if the location_id is unknown before insertion into the databse? { "rules": { "updates": { "<location_id>": { // WHAT IS THIS NODE SUPPOSED TO BE? ".indexOn": ["validFrom"] } } } } data structure sample { "71a57e17cbfd0f524680221b9896d88c5ab400b3": { "-KBHwULMDZ4EL_B48-if": { "place

Changing value in Firebase results in infinite loop

烈酒焚心 提交于 2020-07-23 07:39:24
问题 I want to implement a function of 'add to favorite' by clicking in a star (button). When i click for the first time, set a value to user favorite in firebase and the star will be yellow, and when i click again, it removes from list, and star back to normal. I'm tryin' this code, but is looping. How can i solve this? final DatabaseReference ref = FirebaseDatabase.getInstance().getReference( "Usuarios" ); ref.child( mAuth.getUid() ).child( "Favoritos" ) .addValueEventListener( new

Changing value in Firebase results in infinite loop

自闭症网瘾萝莉.ら 提交于 2020-07-23 07:38:21
问题 I want to implement a function of 'add to favorite' by clicking in a star (button). When i click for the first time, set a value to user favorite in firebase and the star will be yellow, and when i click again, it removes from list, and star back to normal. I'm tryin' this code, but is looping. How can i solve this? final DatabaseReference ref = FirebaseDatabase.getInstance().getReference( "Usuarios" ); ref.child( mAuth.getUid() ).child( "Favoritos" ) .addValueEventListener( new

How to get the Key from data snapshot in Firebase unity c#?

爷,独闯天下 提交于 2020-07-23 07:05:12
问题 I am trying to build a game using Unity and Firebase SDK. I want to get the key of circles in the image. FirebaseDatabase.DefaultInstance .GetReference("live_games") .OrderByChild("gameId").EqualTo(GAME_KEY) .GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { // Handle the error... } else if (task.IsCompleted) { DataSnapshot snapshot = task.Result; Debug.Log("the json " + snapshot.GetRawJsonValue()); Debug.Log("the key is "+ snapshot.Key); // Do something with snapshot... } }); I

How to get the Key from data snapshot in Firebase unity c#?

情到浓时终转凉″ 提交于 2020-07-23 07:04:20
问题 I am trying to build a game using Unity and Firebase SDK. I want to get the key of circles in the image. FirebaseDatabase.DefaultInstance .GetReference("live_games") .OrderByChild("gameId").EqualTo(GAME_KEY) .GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { // Handle the error... } else if (task.IsCompleted) { DataSnapshot snapshot = task.Result; Debug.Log("the json " + snapshot.GetRawJsonValue()); Debug.Log("the key is "+ snapshot.Key); // Do something with snapshot... } }); I

How to get the Key from data snapshot in Firebase unity c#?

若如初见. 提交于 2020-07-23 07:03:05
问题 I am trying to build a game using Unity and Firebase SDK. I want to get the key of circles in the image. FirebaseDatabase.DefaultInstance .GetReference("live_games") .OrderByChild("gameId").EqualTo(GAME_KEY) .GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { // Handle the error... } else if (task.IsCompleted) { DataSnapshot snapshot = task.Result; Debug.Log("the json " + snapshot.GetRawJsonValue()); Debug.Log("the key is "+ snapshot.Key); // Do something with snapshot... } }); I

Insert data to firebase -Android - and check specific properties

删除回忆录丶 提交于 2020-07-23 06:54:21
问题 I need to insert lesson object to firebase, so I put here the onData change section of code. First of all I get data snapshot and insert the lessons that I have in firebase, after that I scan the List of Lessons and check: if the date and time exist in the firebase in any Lesson so I do something else I insert the lesson object to firebase . The main problem is : when I insert the details of the lesson and press add, the lesson enter to the firebase twice minimum, and if I try another

Insert data to firebase -Android - and check specific properties

微笑、不失礼 提交于 2020-07-23 06:53:08
问题 I need to insert lesson object to firebase, so I put here the onData change section of code. First of all I get data snapshot and insert the lessons that I have in firebase, after that I scan the List of Lessons and check: if the date and time exist in the firebase in any Lesson so I do something else I insert the lesson object to firebase . The main problem is : when I insert the details of the lesson and press add, the lesson enter to the firebase twice minimum, and if I try another

Insert data to firebase -Android - and check specific properties

∥☆過路亽.° 提交于 2020-07-23 06:52:30
问题 I need to insert lesson object to firebase, so I put here the onData change section of code. First of all I get data snapshot and insert the lessons that I have in firebase, after that I scan the List of Lessons and check: if the date and time exist in the firebase in any Lesson so I do something else I insert the lesson object to firebase . The main problem is : when I insert the details of the lesson and press add, the lesson enter to the firebase twice minimum, and if I try another