我在firebase(真实的tiem数据库)中拥有下一个结构
不同的聊天室包含不同的成员集(ID列表)
我应该如何对查询进行编码,以仅获取在members
子级中具有给定成员ID的那些聊天室?
我当前的代码:
this.chatRooms$ = this.af.list('chat-rooms', (ref: any) =>
ref
.orderByChild('recentMessage/members/0').equalTo(this.authService.user.chatId) // <-- I should check all members, not /0
// .orderByChild('recentMessage/time') // I also need to order the results, but multiple orderByChild are not supported, how to deal with this? I do not need to order by member.id, only filter..
).valueChanges();
或者我的结构错了,我应该再建一个结构吗?