getReference()与getChild() [英] getReference() vs. 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屋!