我是个新手,尝试过.In javascript (vue),我从消防局获得了多个posts文档
如何通过id从另一个集合检索数据?当我使用creator_id从author函数中获取创建者集合时,将从返回中得到混杂或下面的警告。
db.firestore().collection.collection("articles")
.where("status", "==", 1)
.orderBy("time","desc")
.get()
.then(snap => {
snap.forEach(doc => {
var post = {};
var article = doc.data();
post.id = doc.id;
post.creator = article.creator_id
----- data ----
this.posts.push(post);
});
output : [{id:"",txt:"",creator_id:"this id i will use it"},{},{},{},...]
从这段代码中,我需要使用creator_id检索创建者文档。我想我也会从评论文档中得到同样的结果。我不知道这是不是个好主意。如果你能推荐我
发布于 2021-11-10 15:01:23
Firestore (像许多NoSQL数据库一样)不支持服务器端连接(就像在SQL数据库中一样)。
如果您想显示注释旁边的每个用户的信息(例如,他们的名字),那么您有两个主要选项。
如果你是这个话题的新手,我建议你去看看:
https://stackoverflow.com/questions/69915294
复制相似问题