// 我现在的数据库结构
rcv : {
visible: 'all',
ids: [
[0] : userId,
[1] : user2Id ]
}
这就是我查询以获取它工作的数据的方式。
//服务.ts
getAlbumByUserId(userId) {
return this.afs.collection('albums', ref => ref.where('rcv.visible', '==', 'all').where('rcv.ids', 'array-contains', userId)).valueChanges();
}
//组件.ts
this.service.getAlbumByUserId(this.userId);
但我想设置这样的结构,但我不知道如何在 firebase 中查询嵌套对象
// 数据库结构
rcv : {
visible: 'all',
ids: {
userId: {
id: userId
}
user2Id: {
id: user2Id
}
}
}