I am trying to upload an array from my application to Firestone. However, it continues to show
"firebaseError: function fieldvalue.arrayUnion()" called with invalid data.
Here is my code:
const finalList = this.state.players.map(player => { if(player.Present === true){ return player.id } }) finalList.map( id => dbh.collection("Groups").doc(this.state.group) .collection('Enrolled').doc('ids').update({ players: firebase.firestore.FieldValue.arrayUnion(id) }) ) Note that the array "players" does not exist in the database yet.
(player) => {}and(id)=>{}ids - why not simply send it instead of a map function?dbh.collection("Groups").doc(this.state.group) .collection('Enrolled').doc('ids').update({ players: firebase.firestore.FieldValue.arrayUnion(finalList) })