getReference()与getChild() [英] getReference() vs. getChild()

查看:98
本文介绍了getReference()与getChild()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 database.getReference("foo/bar/123") database.getReference("foo").child("bar").child之间有什么区别("123")是?

我假设下一个将加载完整的"foo"对象,而 database.getReference("foo/bar/123")仅加载"123"对象?

I'm assuming that the later one will load the complete "foo" object whereas database.getReference("foo/bar/123") just loads the "123" object?

我的假设是正确的还是仅加载"123"数据的正确/最有效的方法是什么?

Is my assumption correct or what is the correct / most efficient way to only load data of "123"?

推荐答案

两者是等效的.您可以通过打印

The two are equivalent. You can inspect this manually this by printing the toString() format for both References.

参考很便宜-两种解决方案都没有低效率的问题.尚未加载任何数据.引用只是指向数据库中某个位置的指针.

References are cheap - there's nothing inefficient about either solution. Neither one has yet loaded any data. A Reference is just a pointer to a location in the database.

这篇关于getReference()与getChild()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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