I'm a newbie to try firestore .In javascript (vue) i fetched multi posts doc from firestore
How do I retrieve data from another collection by id? when i use creator_id to fetch creator collection from author function it will be Promiss or underfild alert from return
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"},{},{},{},...]
From this code I need to retrieve the creator document with the creator_id. And I think I'll do the same with the repiles doc from comments doc. I don't know if it's a good idea. If you will recommend me
Firestore (like many NoSQL databases) does not support server-side joins (like you have in SQL databases).
If you want to display information for each user next to their comment (say, their name), you have two main options.
If you're new to this topic, I recommend checking out: