我将通过包含现有(和有用的)firebase数据结构引用来开头:
https://www.firebase.com/blog/2013-04-12-denormalizing-is-normal.html
What's the best way of structuring data on firebase?
Firebase data structure and url
然而,我所知道的是什么,即返回包含给定子字符串的记录的能力 .
具体来说,我想为用户提供一种搜索应用程序的所有(公共)用户的方法(通过用户名/名称/电子邮件/电话/所有这些) .
我不想下载所有用户,然后使用角度过滤器/备用客户端过滤,因为这可能会成为一个大型下载,因为用户群扩展(特别是如果搜索跨越多个集合 - 例如用户名,姓名,电子邮件等 . )
我考虑过使用树形结构,例如:
- users
- username
- a
- an
- and
- andy
- andr
- andre
- andrea
- andrew
- ann
- anne
然后,当用户输入'a',users / username / a / an为'an'等时,我可以引用users / username / a,并且有效地仅基于搜索项引用用户的子集 .
考虑到noSQL性质,以及对数据进行非规范化建议并保持结构平坦的建议, does this structure make sense?
或者, is there an alternative / better way to do a LIKE esque query?