firebase-realtime-database

Realtime database data structure modeling

寵の児 提交于 2021-01-29 14:29:06
问题 We have a chat system for which we have a analytics dashboard. currently we are showing the top said sentences. The model looks like below: messages --key1 -text: "who are you" --key2 -text: "hello" --key3 -text: "who are you" there is a database trigger that every time a new message gets inserted store a count like below stat --topPhrases --keyA --phrase: "who are you" --count: 2 --key --phrase: "hello" --count: 1 Our dashboard now queries this data and shows on dashboard as top sentences

Firebase - Add many apps to one project

我只是一个虾纸丫 提交于 2021-01-29 14:23:30
问题 This is the first time i'm working with firebase. My goal is to have a bounch of client apps (more and more over time), all of them managed by an admin app (One app to rule them all). The thing is that the client apps have a certain content that needs to be updated from the admin app. My best approach is to create a firebase project, put the admin app there and adding client apps over time. I'have read that is possible to have an unlimited number of apps inside one Firebase project. On

Firebase query and delete data in javascript

廉价感情. 提交于 2021-01-29 14:22:10
问题 Here is my firebase I would like to delete the last deed within deeds which happens to be deed id: 1. I would like to do this without specifying anything other than deleting the last deed in deeds. Here is what I have tried already, but I receive no function errors because i'm returning query type objects. const deedRef = admin.database().ref('/deeds'); deedRef.limitToLast(1).once("value", (snapshot) => { snapshot.val().remove(); }) And const deedRef = admin.database().ref('/deeds'); deedRef

How can I put retrieved data from firebase to a widget in Flutter?

旧街凉风 提交于 2021-01-29 13:56:12
问题 final String uid; final firestoreInstance = Firestore.instance; void printData() async{ var firebaseUser = await FirebaseAuth.instance.currentUser(); firestoreInstance.collection("users").document(firebaseUser.uid).get().then((value){ print(value.data); }); } So this function prints to console the retrieved data from firebase firestore when I press the button. But I want to put them into a widget and display them in my app. For ex: Text(printData()) - but it's not allowed. How can I do that?

Firebase database access denied with permission set

我与影子孤独终老i 提交于 2021-01-29 13:45:14
问题 I have carefully looked at other answers to similar questions and as far as I can tell everything is set correctly but still access is denied. Minimum working example: My Firebase Live Database Security Rule for the path 'user/{uid}' is as follows "rules": { "user": { "$uid": { ".read": "auth.uid === $uid", ".write": "auth.uid === $uid && !data.exists() " } } } in the typescript I attempt to read 'user/{uid}' for some user. //Firebase and firebase-fcuntions import const firebase = require(

com.google.firebase.database.DatabaseException: Can't convert object of type java.lang.String to type models.firebase.FirebaseTripDataHolder

天大地大妈咪最大 提交于 2021-01-29 13:42:46
问题 I am trying to get value of every node and its subnodes in the following heirarchy on firebase database. So, I had built the following object Model as a First Approch : public class FirebaseTripDataHolder { String currentStatus,distanceLengthStr, driverId, durationStr, fareEstimate ; public FirebaseTripDataHolder() { } public FirebaseTripDataHolder(String key, String tripStatus, String distanceSTR, String driverIDStr, String durationStr, String fareEstimate) { currentStatus=tripStatus;

Does firebase web client download data every time I subscribe for a certain database path?

假如想象 提交于 2021-01-29 13:09:52
问题 In my angular app, I use AngularFire to access firebase realtime database. I have following method to retrieve entities in a certain database path. private db: AngularFireDatabase; public getAll(): Observable<Item[]> { return this.db.list<Item>('some/db/path').valueChanges(); } If I call above method multiple times, does the data get downloaded multiple times from server, or firebase client uses a local cache second time onward? If data gets downloaded multiple times, is there any way I can

Value of firebase functions onwrite sometimes is null

房东的猫 提交于 2021-01-29 12:54:24
问题 I'm trying to implement an Android ordering system and I'm using Realtime Database. To send notifications I'm using Firebase Functions in JavaScript. Each user is stored in the database along with their id, token to send the notification, among other data. What I'm trying to do is detect when a user receives an order and send them a notification . The problem appears here. In some cases the notification is sent and in others it is not . Viewing the logs of my "sendNotif" function I see that

Firebase transaction returns ArrayList handling

允我心安 提交于 2021-01-29 12:25:01
问题 I'm trying to check if a child already has a value or not, if not then increment a child value and add an array of data inside the child. ex: and expect the code will add second child "2": to do this I use doTransaction to check if there are any values within history/userId value, Date c = Calendar.getInstance().getTime(); SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy", Locale.getDefault()); String formattedDate = df.format(c); PlanHistory planHistory = new PlanHistory(formattedDate

Flutter: Unable to read data from firebase. The method '[]' was called on null error

折月煮酒 提交于 2021-01-29 12:11:01
问题 I am trying to read the data from firebase after scanning a barcode. This is how it should appear, but instead of barcode, it should display name and price from the database (https://m.imgur.com/gallery/lEFJZ0Q) Code: class ListTileModel { String barcode; ListTileModel(this.barcode); } the below code is inside the stateful widget List<ListTileModel> _items = []; String barcode = ""; void _add() { _items.add(ListTileModel(barcode)); setState(() {}); } @override void initState(){ super