【发布时间】:2022-01-02 01:22:51
【问题描述】:
我正在尝试批量输入,但此错误不断发生。 我在 .doc 中传递一个数组,它在其他函数上运行良好,我使用循环和函数将一个数组传递到 .doc。
请帮帮我,请解释一下错误的含义。
export const AddTaskToFriend = (
ArryOfIds,
email,
title,
tag,
prayority,
completed
) => {
return async (dispatch) => {
const db = firebase.firestore();
var batch = db.batch();
for (let i = 0; i < ArryOfIds.length; i++) {
const Collections = db
.collection("Tasks")
.doc(ArryOfIds[i])
.collection("SingleTask");
batch.set(Collections, {
creater: firebase.auth().currentUser.uid,
UpdatedOn: new Date().toString(),
CreatedOn: new Date().toString(),
email,
title,
tag,
prayority,
completed,
});
}
batch
.commit()
.then((success) => {
console.log(` its a success ${success}`);
})
.catch((error) => {
console.log(error);
});
【问题讨论】:
标签: javascript reactjs firebase react-native google-cloud-firestore