【发布时间】:2020-01-14 15:00:12
【问题描述】:
我有一个父集合(类)和该父集合的子集合(学生)。 'student' 集合有一个名为 student_id 的字段。我需要的是获取特定 student_id 的所有课程。
我花了很多时间寻找答案,但找不到答案。请帮我。
我试过这个。但不工作
export class ClassService {
constructor(private db: AngularFirestore) { }
loadClasses(studentId: String) {
return this.db.collection('class', ref => ref.where('students.student_id', '==', studentId)).get();
}
}
请帮忙。谢谢
【问题讨论】:
-
不要描述你的数据库的样子,而是添加它的截图。
-
这看起来很像Firestore - get the parent document of a subcollection 你能试试告诉我它是否有效吗?
-
这能回答你的问题吗? Firestore query subcollections
标签: google-cloud-firestore angular8