I am trying to make my first firebase cloud function. I want to add the value of name field -which is in 'amr' document -inside ahmed document with the field name newName . I made this function but each time it gives an error or don't show anything what is the problem in my function
const functions = require('firebase-functions');
const admin=require('firebase-admin');
admin.initializeApp();
exports.myfunc=functions.firestore.document('Users/amr').onWrite((change,context)=>{
const name=change.data().name;
return admin.firestore().document('Users/ahmed').add({newName:name});
});