firebase-realtime-database

Cloud Function stuck in an infinite loop

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-04 05:51:16
问题 exports.addNewValue = functions.database.ref('/path') .onWrite(event => { event.data.adminRef.update({"timeSnapshot":Date.now()})}) It appears that Date.now() causes an infinite loop in the function because the following does not: exports.addNewValue = functions.database.ref('/path') .onWrite(event => { event.data.adminRef.update({"timeSnapshot":"newString"})}) How do I fix this? 回答1: If you write back to the same location in the database that was previously changed, you can expect this

How to Exclude item from FirebaseRecyclerAdapter or Firebase Reference Android

谁说胖子不能爱 提交于 2020-01-04 05:47:06
问题 I'm working on Activity to show all the others app users except my user and i'm using Java android with Firebase . But i cant find anyway to exclude item from DatabaseReference or from FirebaseRecyclerAdapter . My Activity look like this My Database look like this : My code inside this Activity looks like below : @Override public void onStart() { super.onStart(); database = FirebaseDatabase.getInstance(); myRef = database.getReference().child("users"); FirebaseRecyclerAdapter<Users

Android Firebase wait for data

ぃ、小莉子 提交于 2020-01-04 05:44:09
问题 in my android application I create an activity which contains a ListView which is populated with data from Firebase Database. The JSON Tree of the structure of the database is the following: { "companies" : { "companyX" : { "address" : "50th avenue, NY", "name" : "Spare-Tools Ltd." }, "companyZ" : { "address" : "50th Broadway, NY", "name" : "Burgers and Burgers" } }, "company-requests" : { "companyX" : { "req1" : true "req2" : true } }, "requests" : { "req1" : { "destination" : "Upper Tooting

Firebase - Is there an API to run clean-up scripts on firebase

瘦欲@ 提交于 2020-01-04 05:31:28
问题 My requirement is to run a clean-up job on my firebase DB. Does firebase has an api to run through the database for any such operations? If so can we also clean up references of an object within different data sets? 回答1: At present, Firebase does not allow you to run scheduled tasks. To do so, you will need to set up a cron job which runs a Java or Node.js process to do the cleanup. The cleanup can be done using the remove() method. You might make use of Firebase queries to easily grab the

How to display dynamic data in Accelerated Mobile Pages(AMP) from firebase

喜欢而已 提交于 2020-01-04 05:09:53
问题 I am using firebase backend database for the site (mostly have a 2 page to display content business page, product page) I try to create AMP page with PHP but it's not working. I have lots of business/product to display in APM (page structure is same for both content/data is different to display) How to do this? I try to search in google getting option to make dynamic AMP only using AMP list AMP List I am saving all the JSON file to my hosting, but how to call that JSON file for particular AMP

Is it absolutely correct that nil'ing a Firebase DatabaseReference does NOT stop the observation?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-04 04:13:07
问题 In the Awesome that is Firebase , you do this var r1: DatabaseReference? = nil and then this r1 = Database.database().reference(withPath: "score/bucks") r1!.observe(.childAdded) { snapshot in ... } and then have fun, but eventually you must do something like this private func clearObservations() { // call from viewDidDisappear if r1 != nil { r1?.removeAllObservers() r1 = nil } if r2 != nil { r2?.removeAllObservers() r2 = nil } .. etc etc etc etc etc etc :/ :/ } { Critical aside: it's worth

How do I utilize filters and child elements in Google Firebase Database

纵饮孤独 提交于 2020-01-04 04:12:28
问题 Working on an Android app that is using the new Firebase Database framework. It has data objects that are modeled like this: Where the Top parent (1234-4321) is the 'chat room', the data object are the 'chat messages', and the numbered items (0, 1, 2) are the 'individual message'. I am able to get the entire Database without any trouble and read it via listeners: FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference(); myRef

Filtering items to populate in RecyclerView based on a child key using parseSnapshot(DataSnapshot snapshot)

淺唱寂寞╮ 提交于 2020-01-04 03:14:08
问题 I am developing a forum kind of app where users can post questions and tag them with related technologies. The app has the modules and database similar to the Firebase database repo. I wanted to filter the posts according to their tags. As filtering on server-side is not possible for multiple key values, I had to approach a way to filter it before populating in RecyclerView. I referred a lot of questions here and found Puf's answer relevant for this case. This is my JSON tree "posts" : { "

Firebase database rules – `data.exists()` always seems to be true, possible bug?

隐身守侯 提交于 2020-01-04 02:20:28
问题 I am trying to secure my firebase database to allow the creation of new records, but not allow the deletion of existing records. Ultimately, I plan to utilise Firebase authentication in my app as well, and allow users to update existing records if they are the author, but I am trying to get the simple case working first. However! No matter what I try in the database rules simulator, despite what the documentation seems to suggest, the value of data.exists() seems to always be true. From what

How to get particular key value from firebase data?

我是研究僧i 提交于 2020-01-04 02:09:14
问题 { "DIV_1" : { "ACTINACT" : 1, "COORDINATOR" : "10CA056", "DIV_CODE" : "BSL", "DIV_ID" : 1, "DIV_NAME" : "Bhusawal", "ERP_LOC_CODE" : "CRB", "MTIME" : "2017-04-08T11:02:59", "ZONE_ID" : "ZONE_1" }, "DIV_10" : { "ACTINACT" : 1, "COORDINATOR" : "06CS011", "DIV_CODE" : "UMB", "DIV_ID" : 10, "DIV_NAME" : "Ambala", "ERP_LOC_CODE" : "NRA", "MTIME" : "2017-04-08T11:02:59", "ZONE_ID" : "ZONE_3" } } How to get DIV_ID? Initially i need to compare key(Ex::Here DIV_10) and then DIV_NAME need to be get.