我的用户有朋友。这些朋友在接受请求时会链接一些数据。数据树看起来像这样;
friends
[uid] // the users uid
[uid] // the uid of the friend
status: 'friends'
username: 'UserName1'
这是顶层数据,用于快速向用户显示其朋友的姓名,而不是每个人都需要额外的查询来获取姓名。
问题在于更新用户名。如果UserName1要更改其用户名,则这是需要更新的位置之一。其他位置没有那么深的嵌套,因此没有太大的问题。