Answer the question
In order to leave comments, you need to log in
How to get documents from Firestore from a list?
There is a list of friends (user-id, maybe several hundred) and there are documents with user data.
Question: how to get the data of the desired users using one query (using this selection)?
For example user1 has friends List['user4', 'user2', 'user19', ..n].
How to get these friends' documents for further display (preferably in a Stream)?
Answer the question
In order to leave comments, you need to log in
try to make a list in the document, to which the id-document of the desired user will be added, and then you will simply call it.
import 'package:cloud_firestore/cloud_firestore.dart';
class users{
var userId = 'это id-документа нашего юзера, который выполняет действие';
//здесь мы берем из его документа список id-документов его друзей
//который как я понимаю тоже постепенно наполнятеся
var pathUsers = FirebaseFirestore.instance
.collection('users').doc(userId).get().then((value) => value.data()['arrayOfPath']);
//здесь можем обращаться к данным каждого юзера-друга
var getNeedUserData = FirebaseFirestore.instance
.collection('users').doc(PATHS[index]);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question