I am attempting to execute queries in Angular 6 using Firebase Firestore. I have this code, and I have already installed the package "npm firebase @angularfire" but it is not working:
import { Component } from '@angular/core';
import { AngularFirestore, AngularFirestoreCollection } from
'@angular/fire/firestore';
import {Lesson} from './models/lesson.model'
import { Observable} from 'rxjs';
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
import {switchMap} from 'rxjs/operators';
import * as moment from 'moment';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
lessonRef:AngularFirestoreCollection<Lesson>;
lesson$: Observable<Lesson[]>;
endDate$: BehaviorSubject<Date>;
constructor(afs:AngularFirestore){
this.endDate$ = new BehaviorSubject(new Date('2017-12-24'));
this.lesson$= this.endDate$.pipe(
switchMap(date=>
afs.collection<Lesson>('Lesson', ref =>
ref.where('endDate', "==", date))
.valueChanges(),
),
);
}