Can someone help me with this code snippet I'm working on:
await firebase.firestore().doc(`documents/${documentData.id}`).update({
predictionHistory: firebase.firestore.FieldValue.arrayUnion(...[predictions])
});
The predictions
variable is an array defined as:
export interface PredictionHistory {
predictedAt: firebase.firestore.Timestamp;
predictionText: string;
}
When I run this code, I encounter the following error:
FirebaseError: Function FieldValue.arrayUnion() called with invalid data. Nested arrays are not supported
Any suggestions on how to fix this issue?