I have a Firestore DB with the following structure:
-
users
- [uid]
- name: “User teste”
- [uid]
-
artists
- [id]
- content: “Some teste.”
- timestamp: (Dec. 22, 2017)
- uid: [uid]
- [id]
And in my service
constructor(private afu: AngularFireAuth, private afs: AngularFirestore, private storage: AngularFireStorage) {
this.usersCollection = afs.collection<User>('users');
this.users = this.usersCollection.valueChanges();
}
my method to get users
getUsers() {
return this.users = this.usersCollection.snapshotChanges()
.pipe(map(changes => {
return changes.map(action => {
const data = action.payload.doc.data() as User;
return data
});
}));
}
How to use join between documents ?
user name: User teste
user content: Some teste.