i have a function that creates and add new data to the cloud firestore! i want the function to check if the documents already exist, if so update them otherwise create them! i do not know how its done. can someone help me with this please! thank you all in advance. this is the function.
static void createPostMonday(Post post) {
postsRef.document(post.authorId).collection('Monday').add({
'alOne':post.alOne,
'altwo':post.alTwo,
'althree':post.alThree,
'alFour':post.alFour,
'alFive':post.alFive,
'alSix':post.alSix,
'beOne':post.beOne,
'beTwo':post.beTwo,
'beThree':post.beThree,
'beFour':post.beFour,
'beFive':post.beFive,
'beSix':post.beSix,
'likes': post.likes,
'authorId': post.authorId,
'timestamp': post.timestamp,
});
}