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
///////////////////////////////////////////// ///////////////////////////////////////////////// ///////////////////////////////////////////////
答案 0 :(得分:0)
通过搜索包含“/”的症状解决,因为这是无效的我用“-”替换它解决了我的问题 –