2021年4月7日星期三

Adding multiple filters in Firebase [Swift]

What is the best way to add multiple filters in Firebase? In this example, I'm trying to pull all groups where userId = userId_0001 and username = sean but I can only add one filter. I've read other posts that say to add the second filter afterwards but I'm not sure how to do this so any helpful would be nice.

Firebase database enter image description here

func fetchMyTransactions(completion: @escaping ([Transaction])->()) {                let postRef = self.databaseRef.child("usernames").queryOrdered(byChild: "username").queryEqual(toValue: "userId_0001")      postRef.observeSingleEvent(of: .value, with: { (poster) in                    var resultsArray = [Transaction]()          for post in poster.children {                            let post = Transaction(snapshot: post as? DataSnapshot)              resultsArray.append(post)                        }                    completion(resultsArray)                }) { (error) in          print(error.localizedDescription)      }        }  
https://stackoverflow.com/questions/66996043/adding-multiple-filters-in-firebase-swift April 08, 2021 at 09:07AM

没有评论:

发表评论