我正在使用firestore,在用户Employee集合下我想删除使用id的特定员工。我的代码是
export const employeeSave = ({
name,
phone,
shift,
uid
}) => {
const {
currentUser
} = firebase.auth();
return (dispatch) => {
firebase.firestore().collection('users').doc(currentUser.uid).collection('employees').doc(uid).update({
name,
phone,
shift
}).then(() => {
dispatch({
type: EMPLOYEE_SAVE_SUCCESS
});
Actions.employeeList({
type: 'reset'
});
});
};
};
答案 0 :(得分:0)
听起来你只想打电话给删除
firebase.firestore().collection('users').doc(currentUser.uid).collection('employees').doc(uid).delete()
请点击此处查看更多https://firebase.google.com/docs/firestore/manage-data/delete-data
答案 1 :(得分:0)
.update
需要一个对象或键/值对。所以试试:
.update({
name: "joe",
phone: "123-234-5567",
shift: "night"
})