firebase-realtime-database

Are Firebase Object Keys Guessable?

主宰稳场 提交于 2019-12-25 07:42:03
问题 Say I have data like so: users{ $authId: { name:"", propertiesById:{ uniqueId1:true, uniqueId2:true } } }, properties:{ uniqueId1:{ key:val }, uniqueId2:{ key:val } } Assuming that I have the proper rules in place for users to be able to only read/write their own user object, how do I go about reading my properties safely? I know that in rules, I can go to root, find the user object and ensure that the property that I'm trying to read exists in the propertiesById, but that seems like it would

Firebase 2.0 - Store Date and Timezone

前提是你 提交于 2019-12-25 07:35:06
问题 I need to store the date that something was created in the firebase database for a friend request, how can i store a date in firebase that i can work out how long ago since this date something happened. I would just store an NSDate in there but then what about timezones? I dunno if firebase has something like Parse had where it would store date created and timezone automatically so you could read it from the server? 回答1: You need to set it up by yourself ! I use this code to do the timestamp.

Populate Date and Time into Textview from Firebase

ぃ、小莉子 提交于 2019-12-25 07:27:22
问题 I created a listview with two textviews, i want to get the date and time specific to any data added to the database into the textview from firebase. Is there any method to achieve the aforementioned? Thanks. 回答1: You need to add another child to store the timestamp when saving the data. Your data structure should look something like this "data": { "id1": { "text": "some text", "timestamp": 1472861629000 }, "id2": { "text": "some text", "timestamp": 1472861629000 }, "..." } To save the

Querying data from AngularFire2 with combinelatest

筅森魡賤 提交于 2019-12-25 07:27:18
问题 I could achieve some filtering behaviour with my question querying subset from angularfire2. Now I want to display these values as a list in Angular using ngFor. In my ts file I have: export class OtherAnimals{ public animalList: Observable<{}>; constructor(public af: AngularFire) { this.animalList = Observable.combineLatest( this.af.database.object('/set1/'), this.af.database.object('/set2/'), // Use the operator's project function to emit an // object containing the required values. (set1,

Swift 3 Firebase update code convertion - sorting

╄→гoц情女王★ 提交于 2019-12-25 07:25:29
问题 I enrolled a course on Udemy a while back, on how to create a chat application with Swift and Firebase, simply because I wanted to get an insight of how it all was working. However, I finished the course a week later. This was a couple of months ago, and since then - there has been an update to both Firebase and Swift, and I am currently struggling with converting some of the old code, to new code. Here is the code that I am currently struggling with: func loadRecents() { firebase.child(

Firebase - secure the database from being deleted entirely

前提是你 提交于 2019-12-25 07:19:23
问题 Doing CRUD in firebase is pretty easy and neat IMO. But I am confuse on how to protect the whole database. So I have this database rules : { "rules": { ".read": "auth != null", ".write": "auth != null", } } Let's say I have a bunch of data on my database. If the user is not yet authenticated this code firebase.database().ref('/').set(null) is replying a permission_denied error which is normal. But the problem is once a certain user logs in and gets authenticated, this code firebase.database()

Add key and value to all childs in JSON tree in Firebase

我与影子孤独终老i 提交于 2019-12-25 07:15:21
问题 I want to add key and value to all childs in Firebase("rate":0). This is my JSON tree. How I am able to loop trough the JSON tree and set "rate":0 to all of them like this: I tried doing it with Pyrebase but it was a pain. 回答1: Try:- FIRDatabase.database().reference().child("Snuses").observeSingleEvent(of: .value, with: {(toBeAppendedSnap) in if let snapDict = toBeAppendedSnap.value as? [String:AnyObject]{ for each in snapDict{ let eachKey = each.key if let eachValue = each.value as?

Angular method returns as undefined rather than JSON object

扶醉桌前 提交于 2019-12-25 06:51:49
问题 I have a getUser method within an Authentication provider (working in Ionic 2): getUser(uid: string): any { var toReturn; firebase.database().ref('/userProfile').orderByKey().equalTo(uid).once("value", function(snapshot){ toReturn = snapshot.val(); console.log("getUser = " + JSON.stringify(toReturn)); }); return toReturn; } It retrieves a user object from firebase. It gets output correctly with the console.log providing it exists and is saved in the toReturn variable. Below is the

Firebase 9.0.0 mAuth.signInWithEmailAndPassword, how to pass it to a button

寵の児 提交于 2019-12-25 06:49:27
问题 Wonder why can't start the mAuth.signInWithEmailAndPassword() inside my onClick() button as I've done before. Should i call it another way? but how, It's not much of information out there yet about the new version. Currently it gives be the error String is empty or null: Process: com.example.rasmusjosefsson.rjcar, PID: 30563 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.rasmusjosefsson.rjcar/com.example.rasmusjosefsson.rjcar.LoginAndSignUp.LoginActivity}: java

Getting node names from Firebase database based on emailId match

五迷三道 提交于 2019-12-25 05:32:43
问题 I have the below Json schema , what firebase query can I use to get the node name(0153,0154) , I am able to get the name(joel,vikram,sachin) using once method "EmployeeInfo": { "0153": { "Name":"Joel", "Dept":"Engineering", "Email":"joel@dept.com" }, "0163": { "Name":"Vikram", "Dept":"Engineering", "Email":"vikram@dept.com" }, "0173": { "Name":"Sachin", "Dept":"Engineering", "Email":"Sachin@dept.com" } Here is my javascript function : function Call() { var dbref = new Firebase("https:/