I am trying to return one field in a document. Is there a simple way to do this? This seems overkill:
let p = await (await this.afs.doc(`users/${uid}`).get().toPromise()).data()!.photoURL;
let p = await this.afs.doc(`users/${uid}`).ref.get().then((m) => { return m.data()!.photoURL; });
I was thinking something like this, but obviously it doesn't work:
let p = await this.afs.doc(`users/${uid}`).get('photoURL);
Any ideas?
This should be all that's needed:
let p = await (firebase.firestore().doc(`users/${uid}`).get()).get('photoURL');
The await (firebase.firestore().doc(
users/${uid}).get())
awaits for the document to be loaded, and then then get('photoURL')
gets the field.