ngxs-labs/firestore-plugin

Query documents inside a Subcollection

lyamone opened this issue · 1 comments

Hi guys,

First of all, I would like to thank you because the library is great but I am struggling to query a subcollection.

I have the following service which extends the Ngxs Firestore Class and where I set the path to the parent collection:

import { Injectable } from '@angular/core'; import { Course } from '@course/course.model'; import { NgxsFirestore } from '@ngxs-labs/firestore-plugin'; @Injectable() export class CourseService extends NgxsFirestore<Course> { protected path = 'course'; }
The problem comes when I want to query all the documents within a Subscribers subcollection.
The path looks like this: course/courseId/subscriptions

I tried to change the path with a dynamic one without luck.

In the Angular Fire documentation is possible to query subcollection because we can get the reference:

constructor(private afs: AngularFirestore) { this.userDoc = afs.doc<Item>('user/david'); this.tasks = this.userDoc.collection<Task>('tasks').valueChanges(); }

Is there a way that I am missing to get subcollections? or It's a feature not supported yet in the library?

Thanks!!

Duplicate of #21