【发布时间】:2022-02-16 06:30:38
【问题描述】:
我有节点项目,我正在尝试将 google firebase 集成为项目的数据库。我目前拥有它,以便在调用它时可以从数据库中获取数据。我设置了初始记录,现在我正在尝试将记录附加到 google firebase 数据库。
当我调用db.collection(...).doc(...).push().set(...) 时,它给了我一个错误,说没有调用.push() 的函数。我不知道为什么,因为文档说它应该将新记录附加到数据库中。不知道该怎么办。
这是我当前的代码:
post: (req, res) => {
const body = req.body;
newReivew = {
rating: "",
user: {
id: "feaer323vwe",
profile_url: "",
image_url: "",
name: "John Doe Jr",
},
text: "Thsi is a third review",
time_created: "asdffeasvsesv",
url: "hoots:google.com",
};
db.collection("reviews").doc("yelp_reviews").push().set(newReivew);
},
【问题讨论】:
标签: node.js firebase google-cloud-firestore