firebase-realtime-database

Name Firebase child as sequence array

倾然丶 夕夏残阳落幕 提交于 2020-01-24 18:48:25
问题 I want to use Fusionchart to read my Firebase data and create a chart in my web app. but my Firebase DB has a wrong structure, so the Fusionchart can't get data (my Firebase config is right). Following is the code that I write data to Firebase, num is a value increased in each loop. But as shown in the attached picture, the child's name is not added as a sequence number. Another question is I don't want the unique key inside the child 1, just six various inside the child one is ok. Any

firebase set failed first argument contains undefined in property

孤人 提交于 2020-01-24 13:08:15
问题 When I create an event, I do this: export const eventCreate = ({ title, time, location }) => { const newPostKey = firebase.database().ref('/events').push().key; const update = {}; const postDetails = { eventId: newPostKey, title, ... goingNumber: 1, ... }; update[`/events/${newPostKey}`] = postDetails; return (dispatch) => { firebase.database().ref() .update(update) .then(() => { dispatch({ type: EVENT_CREATE }); }) .then(() => newPostKey); }; }; in the database: later when I try to update

How to add and view child objects in Firebase (Android)?

久未见 提交于 2020-01-24 12:20:11
问题 I am having a similar issue in which I have my files as follow in which I want to be able to view all child items and add new child items. I understand that you will have to modify the code in the Java file, but I am having trouble understanding how to manipulate my own code and I tried to follow the confusing documentation provided by Firebase. Below is the structure of my database followed by my code. Any help would be greatly appreciated. The only problem I have now is how to properly

Firebase set data structure

寵の児 提交于 2020-01-24 12:11:50
问题 Hi I'd like to know if there's a way to force the DB structure when using Firebase Console. For example I need to add an object with name: "Sample" and value: 3, then when I want to add another object i can only insert object with the same structure (name and value). Is there any way to achieve this? 回答1: There is no way to enforce a certain data structure when entering data using the Firebase Console. When you access the Firebase Database through the Firebase Console (console.firebase.google

unspecified index when searching data with firebase cloud function on nested object running nested Query

限于喜欢 提交于 2020-01-24 10:34:46
问题 I'm using fire-base to retrieve nested data of users node, and while running query I'm facing this issue fetching data from fire-base database. Consider adding ".indexOn": "userId" at /users/YJdwgRO08nOmC5HdEokr1NqcATx1/following/users to your security rules for better performance. Database Structure: "users" : { "1vWvSXDQITMmKdUIY7SYoLA1MgU2" : { "userEmail" : "test2kawee@gmail.com", "userId" : "1vWvSXDQITMmKdUIY7SYoLA1MgU2", "userName" : "Malik Abdul Kawee", "userPhoneNumber" : "",

onDataChange is getting called twice in android Firebase

送分小仙女□ 提交于 2020-01-24 02:12:04
问题 Here is My simple query for firebase data using timestamp in android app Query recentStaticJobQuery = reference.child(AppConstants.WORKINDIA_JOBS) .child(AppConstants.WORKINDIA_STATIC_JOBS) .orderByChild(AppConstants.TIMESTAMP) .startAt(lastStaticJobSyncTime); recentStaticJobQuery.addListenerForSingleValueEvent (staticJobDownloadListener); ValueEventListener staticJobDownloadListener = new ValueEventListener() { @Override public void onDataChange(final DataSnapshot dataSnapshot) { Log.i(

Retrieving data in alphabetical order using Firebase in Android Studio [duplicate]

半腔热情 提交于 2020-01-24 00:31:07
问题 This question already has answers here : How can I sort an ArrayList of Strings in Java? (5 answers) Closed 4 years ago . This question is a follow up question from a previous post. Is there anyway to order the results alphabetically? I'm looking for something like Query 's orderByValue() . ... protected ArrayList<String> usernames = new ArrayList<>(); Firebase userRef = ref.child("users"); userRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange

AngularJS Firebase $add is not a function

泪湿孤枕 提交于 2020-01-24 00:15:27
问题 I try to push a new record to my Firebase. But everytime I receive a console error like this: $scope.contacts.$add is not a function Here is my code: app.controller('contactsCtrl',['$scope','$firebaseObject',function($scope,$firebaseObject){ var ref = new Firebase("https://<database_details>.firebaseio.com/contacts"); $scope.contacts = $firebaseObject(ref) $scope.addContact = function(){ $scope.contacts.$add({ name: $scope.name, address: $scope.address, telephone: $scope.telephone, company:

Create dashboard on Firebase Database for various metrics

笑着哭i 提交于 2020-01-23 17:31:28
问题 I have events in firebase database table where each event has certain fields. One of the field is event_type . What I want to achieve is to be able to visualize in graphical form, how many events of each type comes daily? How do I do something like that in firebase database? Q1. Is it possible to directly do this in firebase? Q2. Do I need to move data to some other datasource (like Big query) and setup dashboard there? 回答1: It is definitely possible to create a dashboard with aggregate data

(setValue:) Cannot store object of type _SwiftValue at pictureURL. Can only store objects of type NSNumber, NSString, NSDictionary, and NSArray

我与影子孤独终老i 提交于 2020-01-23 07:27:07
问题 Having some issues understanding firebase with Swift 3. I've remade my observer to look like this: currentUserFirebaseReference.observeSingleEvent(of: .value, with: { (snapshot: FIRDataSnapshot) in let UID = snapshot.key let dict = snapshot.value as! Dictionary<String,AnyObject> let pictureURL = dict["pictureURL"] as! String I used to just do observation..... in { let picture = snapshot.value!["pictureURL"] But now I guess you have to explicitly tell Firebase that you're dealing with a