我如何在 firebase 中进行查询?在 oracle sql 上查询将是
"select * from users where username = "SomeUser"
我需要在 Firebase、Swift 3 中做同样的事情
最佳答案
您需要使用 queryOrderedByChild
和 queryStartingAtValue
。这应该会让您朝着正确的方向开始。
queryStartingAtValue(用户名).queryEndingAtValue(用户名)
let username = "SomeUser"
FIRDatabase.database().reference.child("users").queryOrderedByChild("username").queryStartingAtValue(username).queryEndingAtValue(username).observeEventType(.ChildAdded, withBlock: { (snapshot) -> Void in
}
queryEqual(toValue: 用户名)
let searchRef = FIRDatabase.database().reference().child("users").queryOrdered(byChild: "username").queryEqual(toValue: username)
关于ios - 查询和 Firebase 中的位置(swift 3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41038228/