Firebase获取数据 [英] Firebase get data

查看:130
本文介绍了Firebase获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从x值等于y的firebase中获取数据。我阅读所有的文档,但是我找不到有用的东西来做到这一点。任何帮助将不胜感激

我需要像这样
$ c $ b

解决方案

您需要创建一个引用,按子键排序,然后指定 equalTo()子句。

  let ref = Firebase(url: https://dinosaur-facts.firebaseio.com/dinosaurs)
ref.queryOrderedByChild(height)。queryEqualToValue(25)
.observeEventType(.ChildAdded){(snapshot:FDataSnapshot)in
print(snapshot.key)
})

查看关于查询更多信息的文档


I need to get data from firebase where 'x' value equal to 'y'. I read all documentation, but I couldn't find anything helpful to do this. Any help will be appreciated

I need something like this SELECT * FROM table_name WHERE x = y

解决方案

You need to create a reference, order by the child key, and then specify an equalTo() clause.

let ref = Firebase(url: "https://dinosaur-facts.firebaseio.com/dinosaurs")
ref.queryOrderedByChild("height").queryEqualToValue(25)
   .observeEventType(.ChildAdded) { (snapshot: FDataSnapshot) in
    print(snapshot.key)
})

See the docs on querying for more information.

这篇关于Firebase获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆