firebase-realtime-database

Post request to firebase without unique key

坚强是说给别人听的谎言 提交于 2020-02-14 12:49:19
问题 I want to post new data to my firebase API, but everytime I do so, a new key, like -L545gZW7E6Ed6iqXRok is generated with my object inside it. I would like to save my object directly to the API without this new key. This SO question answers how to do it using the set() method, but I would like to achieve this using Postman. I am posting directly to firebase using Postman. url: https://my-firebase-project.firebaseio.com/galaxies.json with method POST. //current saving like this in firebase

Post request to firebase without unique key

梦想与她 提交于 2020-02-14 12:46:25
问题 I want to post new data to my firebase API, but everytime I do so, a new key, like -L545gZW7E6Ed6iqXRok is generated with my object inside it. I would like to save my object directly to the API without this new key. This SO question answers how to do it using the set() method, but I would like to achieve this using Postman. I am posting directly to firebase using Postman. url: https://my-firebase-project.firebaseio.com/galaxies.json with method POST. //current saving like this in firebase

retrieve data currentuser. from firebase return null

本小妞迷上赌 提交于 2020-02-08 02:34:30
问题 Hello I'm trying to retrieve the data from a realtime firebase field but it returns null. I checked with textView52.setText (firebaseUser.getEmail ()); to see if it was really connected and it works. the problem is in recovering a value from the database which in this case is the field "name" could someone help me? am i doing something wrong? any help is welcome. DatabaseReference ref = FirebaseDatabase.getInstance().getReference("Users"); ref.child("Users").addListenerForSingleValueEvent(new

Swift 5, how to execute code after fetching all childadded from Firebase

狂风中的少年 提交于 2020-02-07 05:18:06
问题 How can I execute some code after fetching all childadded from Firebase in Swift 5? I've tried using DispatchGroup and observe .value, but none of them worked efficiently. let dispatchGroup = DispachGroup() ref.child("path").observe(.childAdded, with: { (snapshot) in self.dispatchGroup.enter() //store snapshot data into an object self.dispatchGroup.leave() }) dispatchGroup.notify(queue: .main) { //code to execute after all children are fetched } In this case, the code will be executed before

How I can get data of next child and show it in list view from firebase realtime database

爱⌒轻易说出口 提交于 2020-02-07 03:50:13
问题 I am developing an Audio Hadith, now I want to show the first key as a category like Ramadan , Zakat etc and in every category, there will lot of audio hadith's title and audio URL. This is the database structure image: public void readHadiths(final DataStatus dataStatus){ mDbReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { hadiths.clear(); List<String> keys = new ArrayList<>(); for (DataSnapshot keyNode :

Filtering Observable with Rxjs

烂漫一生 提交于 2020-02-06 08:25:54
问题 I'm trying to get a list of active jobs for the current user: jobListRef$: Observable<Job[]>; ... this.afAuth.authState.take(1).subscribe(data => { if (data && data.uid) { this.jobListRef$ = this.database.list<Job>('job-list', query => { return query.orderByChild("state").equalTo("active"); }) .snapshotChanges().map(jobs => { return jobs.map(job => { const $key = job.payload.key; const data = { $key, ...job.payload.val() }; return data as Job; }); }) .filter(val => val.map(job => { return

Filtering Observable with Rxjs

寵の児 提交于 2020-02-06 08:25:48
问题 I'm trying to get a list of active jobs for the current user: jobListRef$: Observable<Job[]>; ... this.afAuth.authState.take(1).subscribe(data => { if (data && data.uid) { this.jobListRef$ = this.database.list<Job>('job-list', query => { return query.orderByChild("state").equalTo("active"); }) .snapshotChanges().map(jobs => { return jobs.map(job => { const $key = job.payload.key; const data = { $key, ...job.payload.val() }; return data as Job; }); }) .filter(val => val.map(job => { return

How to delete a specific child from Firebase (java)? [duplicate]

孤街浪徒 提交于 2020-02-06 07:27:05
问题 This question already has answers here : How to remove child nodes in firebase android? (3 answers) Closed 2 years ago . I want to delete only the 1st child ( L7jrJ6DtQWrmZsC4zvT ) from Firebase database with an option in an Android app. I searched several places and could not find it. You only have one option to delete a whole database. Can anyone help? 回答1: If i understood you correctly, you have the key of the child you want to remove and this child has no parent. so you can just use the

How to delete a specific child from Firebase (java)? [duplicate]

纵饮孤独 提交于 2020-02-06 07:26:34
问题 This question already has answers here : How to remove child nodes in firebase android? (3 answers) Closed 2 years ago . I want to delete only the 1st child ( L7jrJ6DtQWrmZsC4zvT ) from Firebase database with an option in an Android app. I searched several places and could not find it. You only have one option to delete a whole database. Can anyone help? 回答1: If i understood you correctly, you have the key of the child you want to remove and this child has no parent. so you can just use the

How to restrict users from writing more than once in a database

旧巷老猫 提交于 2020-02-05 05:07:27
问题 I am working on a Bus booking app. So whenever a user books a ride I will store his credentials(name, email) for that particular ride. I need to restrict the number of bookings for that ride(like only 20 per ride). To do this I am using Firebase transactions. But how to restrict them from booking more than once for a particular time in a day. Can anyone tell me how? Below is my code for database(mref1 is the location where I want to store the number of bookings) private DatabaseReference