错误 [FirebaseError]:文档参考无效。文档引用必须具有偶数个段

时间:2021-01-24 07:27:40

标签: node.js firebase google-cloud-firestore

const firebase = require("firebase");
// Required for side-effects
require("firebase/firestore");

// Initialize Cloud Firestore through Firebase
firebase.initializeApp({
    apiKey: "____",
    authDomain: "____",
    projectId: "____"
  });
  
var db = firebase.firestore();

var datasetSymptom=[{
    "Disease" : [ "edema pulmonary" ],
    "Symptom" : "Heberden's node"
  }, {
    "Disease" : [ "cholecystitis" ],
    "Symptom" : "Murphy's sign"
  }, {
    "Disease" : [ "hemiparesis", "hypertension pulmonary", "transient ischemic attack" ],
    "Symptom" : "Stahli's line"
  }
  ]

datasetSymptom.forEach(function(obj) {
    db.collection("datasetSymptom").doc(obj.Symptom).set({
        Disease: obj.Disease
    })
});

我已经在另一个集合上运行了相同的算法,名称与文档相同,症状数组与字段相同。它工作得很好。 错误:

Disease

///////////////////////////////////////////// ///////////////////////////////////////////////// ///////////////////////////////////////////////

1 个答案:

答案 0 :(得分:0)

通过搜索包含“/”的症状解决,因为这是无效的我用“-”替换它解决了我的问题 –

相关问题