Can someone please enlighten me as I can't get the grasp on what this is all about using Angular and Firestore.
Started using Google Firebase and tried to implement CRUD using Firestore.
What is the difference between this library.
import { Firestore } from '@angular/fire/firestore'
...
this.coll = collection(this.firestore, 'user-services');
collectionData(this.coll, {
idField: 'id'
}).pipe(shareReplay({ bufferSize: 1, refCount: true }))...
And the other firestore library used in the git repository in the documentation.. (https://github.com/angular/angularfire/blob/bea9d6774ce455d50363f9844ea48c32d6c37eb6/docs/firestore/collections.md)
import { AngularFirestore, AngularFirestoreDocument } from '@angular/fire/compat/firestore';
I think this is really weird that there is no straight line on which to use, if I try to use them both the first one stops working..
Can someone explain to me what's happening under the hood or provide some history / usage guide which one is newest / safest to use?
Kind regards!
They changed a lot in version 9 so they provided a compatibility layer "@angular/fire/compat/firestore" to allow a smoother migration coming from firebase 8.
The import "@angular/fire/firestore" is the new tree shakeable version for a smaller bundle size.
In your case if it's brand new project you should not use the compatibility layer.
You can read more here https://firebase.google.com/docs/web/modular-upgrade