Article
home/blog/Loading

How query the Firebase Firestore in Angular

To query the firebase firestore in angular you can do the following

First import the firestore

import { AngularFirestore, DocumentChangeAction } from '@angular/fire/firestore';

Constructor

constructor(
        db: AngularFirestore // inject the firestore
    ) {
        db
            .collection('some-collection/') // reference the collection
            .snapshotChanges()
            .subscribe((myDocuments) => console.log(myDocuments.payload.doc.data()));
    }