firebase-realtime-database

Updating Data in Firebase using React and Axios

你说的曾经没有我的故事 提交于 2020-11-29 12:16:11
问题 I'm trying to update some data in a firebase database. However i am unable to get the updateAPI function to work properly. I believe it's something to do with axios.put, the url is probably not traversing the data correctly? I have tried changing the url but end up with a OPTIONS and CORS errors which means the url is incorrect. // API Function calls async getAPI(){ const response = await axios.get('https://fir-test-euifhefibewif.firebaseio.com/todos.json') console.log(response) console.log

Why does Firebase's Realtime Database's child_removed event handler not execute?

大城市里の小女人 提交于 2020-11-29 10:34:46
问题 My database contains: user: { 'monkey': 'banana', 'bear': 'fish' } Why does the event handler not execute? let db = firebase.database(); let user = db.ref('user'); user.on('child_removed', (e) => { console.log(e.val()); }); user.child('monkey').remove(); 回答1: This looks like some race going on with the code, because I tested and if you do something like this: setTimeout(function() { user.child('monkey').remove(); },2000); it seems to work. Here is a fiddle I used to test it out, hope it helps

How to do order by child inside another child Firebase

六眼飞鱼酱① 提交于 2020-11-29 02:54:32
问题 I am trying to get all data ordered asc and desc by child value that inside another child. In main scope of class: FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference dbRef = database.getReference("university"); i have data structure like this { "university": { "13": { "name": "value" "exam": { "exam_date": "value" "reg_date": "value" } } "15": { "name": "value" "exam": { "exam_date": "value" "reg_date": "value" } } "20": { "name": "value" "exam": { "exam_date":

How to do order by child inside another child Firebase

佐手、 提交于 2020-11-29 02:53:33
问题 I am trying to get all data ordered asc and desc by child value that inside another child. In main scope of class: FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference dbRef = database.getReference("university"); i have data structure like this { "university": { "13": { "name": "value" "exam": { "exam_date": "value" "reg_date": "value" } } "15": { "name": "value" "exam": { "exam_date": "value" "reg_date": "value" } } "20": { "name": "value" "exam": { "exam_date":

Firestore Document “Too much contention”: such thing in realtime database?

被刻印的时光 ゝ 提交于 2020-11-25 04:05:36
问题 I've built an app that let people sell tickets for events. Whenever a ticket is sold, I update the document that represents the ticket of the event in firestore to update the stats. On peak times, this document is updated quite a lot (10x a second maybe). Sometimes transactions to this item document fail due to the fact that there is "too much contention", which results in inaccurate stats since the stat update is dropped. I guess this is the result of the high load on the document. To

Firestore Document “Too much contention”: such thing in realtime database?

被刻印的时光 ゝ 提交于 2020-11-25 04:04:25
问题 I've built an app that let people sell tickets for events. Whenever a ticket is sold, I update the document that represents the ticket of the event in firestore to update the stats. On peak times, this document is updated quite a lot (10x a second maybe). Sometimes transactions to this item document fail due to the fact that there is "too much contention", which results in inaccurate stats since the stat update is dropped. I guess this is the result of the high load on the document. To