firebase-realtime-database

Query-based rules with auth.uid not working

↘锁芯ラ 提交于 2019-12-21 12:31:22
问题 I have the following structure: events -LEe7X118dkcH2JhJRe description: "Testdescr" eventTasks participants 0zlwpSlCazNGjOyMi95h8awshrG2 lastLogin: 1528641494535 userKey: "0zlwpSlCazNGjOyMi95h8awshrG2" username: "User1" 6LnYKxRu2SWUrxwIzId8dDpOrl02 lastLogin: 152856590172 userKey: "6LnYKxRu2SWUrxwIzId8dDpOrl02" username: "User2" I want to query all events, to which an user participants (like a filter). My Java-Code is: mDatabaseReference = FirebaseDatabase.getInstance().getReference("event");

Android Firebase Query

僤鯓⒐⒋嵵緔 提交于 2019-12-21 12:20:09
问题 I have this structure Now, Im making a query like this: DatabaseReference myRef = database.getReference("users"); myRef.equalTo("6991580","ci").addListenerForSingleValueEvent(new ... I was expecting the second node as result.. Then I get: DataSnapshot { key = users, value = null } So, what is wrong with this query? or maybe Im doing something wrong? Best regards and thanks for reply. 回答1: You need to tell Firebase what child property you want to order/filter on: myRef.orderByChild("ci")

Group of users in firebase

非 Y 不嫁゛ 提交于 2019-12-21 09:26:50
问题 A User is defined as: public class User { private String email; private String uid; private List<Group> groups; public User(String email, String uid) { this.email = email; this.uid = uid; this.groups = new ArrayList<>(); } public User() {} public User(String email, String uid, ArrayList<Group> groups) { this.email = email; this.uid = uid; this.groups = groups; } public String getEmail() { return email; } public String getUid() { return uid; } public List<Group> getGroups() { return groups; }

How to query one field then order by another one in Firebase cloud Firestore?

余生长醉 提交于 2019-12-21 09:14:24
问题 I'm struggling to make a (not so) complex query in firebase cloud firestore. I simply need to get all docs where the id field == a given id. Then order the results by their date and limit to 10 results. So this is my current situation db.firestore().collection('comments') .where("postId",'==',idOfThePost) .orderBy('date','asc').limit(10).get().then( snapshot => { //Nothing happens and the request wasn't even been executed }) I can get the result only if i don't use the orderBy query but i

Firebase References undeclared

喜夏-厌秋 提交于 2019-12-21 08:55:49
问题 I created a new Xcode project, added the 'Firebase' pod to my pod file and installed it, and added the Google-services.plist file and the rest according to the Firebase documentation. import Firebase works fine, but if I try var ref:FIRDatabaseReference! in the same ViewController, then it throws an error: Use of undeclared type 'FIRDatabaseReference' And this happens for any Firebase References. Any ideas on this? I am very new to Swift and the xCode IDE. 回答1: Just had the same problem, but

How to observe all firebase database events between two users at concurrent time?

依然范特西╮ 提交于 2019-12-21 06:39:14
问题 First off, if you have a suggestion for a better title or actual question for this submission, please feel free to edit. I'm stuck as to how to succeed in asking this question. So I've made gone through several Firebase chat (iMessage/ Facebook chat) tutorials for swift. I know how to send a message - let ref = Database.database().reference().child("Message") let childRef = ref.childByAutoId() let toID = finalSelected.ContactID as Any let fromID = Auth.auth().currentUser?.uid let values = [

How to update value in Firebase with childByAutoId?

守給你的承諾、 提交于 2019-12-21 06:04:56
问题 When I create objects in Firebase, I use childByAutoId. How can I update these specific objects later? I'm having trouble obtaining the value of the key Firebase automatically updates. Snapshot.key just returns "users". Here's my JSON structure: { "users" : { "-KQaU9lVcUYzIo52LgmN" : { "device" : "e456f740-023e-440a" "name: "Test" } }, How can I get the -KQaU9lVcUYzIo52LgmN key? I want to update the device child. Here's what I have so far. It currently creates a completely separate snapshot

Follower counter not updating node in firebase

蓝咒 提交于 2019-12-21 05:57:10
问题 I have been trying to implement a "follow" function on my app. Essentially when a user hits the "follow" button, we run a runTransactionBlock to update integer values we are storing on Firebase database for the user and the account they are following. The issue is that I am able to update the counter for the user (say John in example below) , but I am not able to update the counter for the user I am following (say olivia in example below). Currently the Firebase nodes look as such: user

how to get data within firebase, when we have many to many relationship

老子叫甜甜 提交于 2019-12-21 05:39:06
问题 I read this question Many to Many relationship in Firebase, and here describes how to create or structure many to many relationship within firebase(nosql database), and it is pretty easy, companyContractors companyKey1 contractorKey1: true contractorKey3: true companyKey2 contractorKey2: true contractorCompanies contractorKey1 companyKey1: true, companyKey2: true contractorKey2 companyKey2: true contractorKey3 companyKey1: true but when i want to get all contractors specific company, can i do

Angular2 fire has no exported member 'FirebaseListObservable'

限于喜欢 提交于 2019-12-21 05:29:10
问题 This is my package.json "dependencies": { "@angular/cdk": "^2.0.0-beta.8", "@angular/common": "^4.3.4", "@angular/compiler": "^4.3.4", "@angular/core": "^4.3.4", ....//others "firebase": "^4.5.0", "angularfire2": "^5.0.0-rc.0", }, "peerDependencies": { "@angular/common": ">=2.3.1" }, "devDependencies": { ..others "typescript": "~2.3.3", "webpack": "^3.6.0" } ow in my app module export const firebaseConfig = { apiKey: "value", authDomain: "value", databaseURL: "value", projectId: "value",