我使用100000
将record
push
RangeError: Maximum call stack size exceeded
插入firebase数据库,
但我收到的错误如下:
for (var i = 0; i < unamelist.length; i++) {
var uname = unamelist[i];
var Actionref = firebase.database().ref("Actionusers/" + mkey);
var newData = {
Actiontype: 3,
status: true,
Iscompleted: 0,
username: uname.toLowerCase(),
datetime: firebase.database.ServerValue.TIMESTAMP
}
Actionref.push(newData,function (error) {
if (error) {
console.log('Error while push Action users from excel: ' + error)
}
else{
var testActionref = firebase.database().ref("Actionusers/" + mkey);
testActionref.once('value').then(function (snap) {
var stupdateref1 = firebase.database().ref('Msgtemplate/' + mkey);
stupdateref1.update({
Rest: snap.numChildren()
})
})
}
})
}
我的代码如下:
fatal: Not a git repository (or any of the parent directories): .git
答案 0 :(得分:0)
Thanx @frank for quik look,
我只是通过下面的代码来解决我的问题:
for (var i = 0; i < unamelist.length; i++) {
var uname = unamelist[i];
console.log(uname);
var Actionref = firebase.database().ref("Actionusers/" + mkey);
var newData = {
Actiontype: 3,
status: true,
Iscompleted: 0,
username: uname.toLowerCase(),
datetime: firebase.database.ServerValue.TIMESTAMP
}
Actionref.push(newData)
if (i == (unamelist.length-1)) {
Actionref.once('value').then(function (snap) {
var stupdateref1 = firebase.database().ref('Msgtemplate/' + mkey);
stupdateref1.update({
Rest: snap.numChildren()
})
})
}
}
我想当我每次在不同节点中更新Actionusers
时将数据推送到Rest
时,这就是为什么数量非常大的呼叫数量。
要解决此问题,我只需在完成for循环后更新Rest
并解决我的问题。