【发布时间】:2017-08-24 02:52:02
【问题描述】:
我正在尝试在 Firebase 上执行与联接查询等效的 SQL,但我希望它仅在键 privacy 等于 public 时才加入。
下面的代码没有返回结果。如果我删除 child(key) 那么它工作正常,但它不会加入。我真的很想得到一些帮助。
circleQuery?.observe(.keyEntered, with: { (key: String!, location: CLLocation!) in
self.locationRef.child(key).queryOrdered(byChild: "privacy").queryEqual(toValue : "public").observeSingleEvent(of: .value, with: { (locationSnapshot) in
if !locationSnapshot.exists() { return }
// returns no results
}) { (error) in
print(error.localizedDescription)
}
})
【问题讨论】:
-
你想在 FirebaseDb 中查询并得到结果?
-
是的。据我了解,要执行连接语句的 SQL 等效项,我应该将两个表的键设置为等效,我已经这样做了。这里的不同之处在于我想让第二个查询有条件,即如果隐私设置为公开。这有意义吗?
标签: swift firebase firebase-realtime-database geofire