Closed wahaj-47 closed 2 years ago
Hi @wahaj-47
Assuming registeredPlayers is relational to Flamelink User (fl_users)
const registeredPlayersRefs = item.registeredPlayers.map({ uid } => firebaseApp.firestore().collection('fl_users').doc(uid));
app.content.update({
schemaKey: "events",
entryId: item.id,
data: {
registeredPlayers: [...registeredPlayersRefs, userDocument.ref],
},
});
note firebaseApp is not the flamelink app instance but the raw firebaseApp you instantiated
Does this help?
Yeah I came up with the same thing. I was just wondering if maybe we could do it without having to map over the array. Thanks.
The field registeredPlayers is a tree so I get an array of references but because I am populating it, I get the document data. Now I want to update this array and push another reference into it. But I don't have the references so if I try:
Then I end up with an array containing a document object and a document reference.