I can quite easily find how to add triggers for firestore events but I can't find any documentation on how to use firebase functions to write to firestore.
For example I have the following:
export const listener = functions.auth.user().onCreate((x)=>{
//firestore function to add an entry for user with fields...
})
There doesn't seem to be a way to do this? Is it that the logic for adding data to firestore should be written client side? If so wouldn't that mean I would need to re-write that functionality for every platform?
You can use the Firebase Admin SDK to read and write Firestore in the same way you'd use it to read and write Realtime Database. There are plenty of official examples, especially this quickstart.
const admin = require('firebase-admin');
admin.initializeApp();
admin.firestore().collection('messages').add({original: original}).then(writeResult => {
// write is complete here
});