I have two collections in my database one called Buyers and the other called Sellers. Whenever the buyer follows the seller I save the seller's Uid in a subcollection called userFollowings in the Buyers collection.
How can I save the followers Uids too? Save the buyer uid in a subcollection called userFollowers in the Sellers collection every time a buyer follows a seller?
here's my code:
const onFollow = () => {
firebase.firestore()
.collection("Buyers")
.doc(firebase.auth().currentUser.uid)
.collection("userFollowings")
.doc(props.route.params.uid)
.set({})
}
const onUnfollow = () => {
firebase.firestore()
.collection("Buyers")
.doc(firebase.auth().currentUser.uid)
.collection("userFollowings")
.doc(props.route.params.uid)
.delete()
}