如何为当前用户添加另一个字段?

时间:2021-03-10 10:48:48

标签: reactjs firebase

This is my firestore. I wanted to add in the field for that user assuming that she was the currentUser.

But this is what happens, it created another document of users with a field of Address 我想为当前用户添加另一个字段。目前,我可以添加另一个字段,但它是在另一个文档中创建的。

const { currentUser } = useSelector(mapState);

const userRef = firestore.collection('users').doc(currentUser.uid);

    async function addAddress() {
       const res = await userRef.set({
           'Address' : 'Ayala'
       }, { merge : true});
    }

0 个答案:

没有答案
相关问题