Angular firestore - getting all data from the same property field after querying an array in a collection

Viewed 135

I want to get all SubjectName of all documents.

Image

I guess it would look something like this:

  getSubjectForUsertest() {
  return this.db.collection('subjects', ref => ref.where('userId', 'array-contains', 'P8lhYVtJ6rU2jf5UtTxYr04naX83'))
   .get().subscribe(snap => {
     snap.forEach(doc => {
       // Something 
     })
   });
  }

Or maybe it's not even possible?

0 Answers
Related