Ok, so this feature is semi-working:
API.FIRESTORE_DOCUMENT_USERID(userID: userID).updateData(["user_rating":FieldValue.arrayUnion([averageRating])])
As you can tell, I'm trying to update the user_rating
field and pass in the average rating. However, since the average rating can be anywhere from 1-5, including decimals/doubles, there is a likelihood that the average rating will already exist i.e. 1.5, 2.5, 2.7
etc. However, I cannot seem too append the same value twice. If I change the rating, then sure I can append. As far as I'm aware, each entry in an array has it's own ID? Any way I can allow for duplicates?
Thank you.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…