晚上好, 我正在使用meteor编写一个词汇应用程序。所以我使用我的函数inputVocab将我的词汇保存在Collection中。这样可行。但现在我想在这两个词汇之间创建某种“连接”,并将此连接保存在另一个数据库(集合)中。这个“connectionobject”应该包含两个id,即文档的id。 所以我虽然我可以调用方法inputVocab作为createConnectionObject的参数,如:
createConnectionObject(collection, inputVocab(collection, vokabel, sprache), inputVocab(collection, vokabel, sprache), typ);
我试了但是有一个拖延的错误: 未捕获RangeError:超出最大调用堆栈大小
function inputVocab(collection, vokabel, sprache){
var id = collection.insert({
vocab: vokabel,
language: sprache
});
console.log("Gespeichert " + vokabel + " " + sprache);
return id;
}
function createConnectionObject(collection, idOne, idTwo, typ){
var idCon = collection.insert({
type: typ,
referenc1: idOne,
referenc2: idTwo,
amountConnections: 2
});
}
所以我搜索并找到一个帖子,其中有人说要避免这个问题,我要将id转换为String或Int但是我该怎么做或者是否有更好的解决方案
此外,代码正在客户端上运行