我正在尝试Firebase的新Firestore。当我从https://firebase.google.com/docs/firestore/manage-data/add-data?authuser=0运行代码示例时,出现错误。Firestore Web代码示例提供了无效的参数类型
// Add a new document with a generated id.
db.collection("cities").add({
name: "Tokyo",
country: "Japan"
})
.then(function(docRef) {
console.log("Document written with ID: ", docRef.id);
})
.catch(function(error) {
console.error("Error adding document: ", error);
});
捕获到异常:(FirebaseError):功能CollectionReference.add()要求它的第一个参数是类型的对象,但它是:定制对象对象
编辑: 对不起我没有提到我使用GWT和JSNI,它的正常工作没有GWT
从快速扫描您的代码看起来是正确的,这让我想知道是否从样本复制了一些不可打印的字符。你可以尝试输入你传入的JSON对象,看看是否有所作为? –
我再次输入,没有区别 –
嗯....在这种情况下,我不知道。希望别人有更好的主意。 –