Description
Describe your environment
- Operating System version: OSX 10.13
- Firebase SDK version: 4.5.0
- Firebase Product: firestore
Describe the problem
I think that there is a serious issue with firebase-js-sdk of with firestore itself. In my I app I need to fetch data of multiple documents from different collections. Assume we have following structure: collection "customers", contains documents "customer" with subcollection "products" of "product" documents
Now, let say that I have list of customerId&productId pairs, which need to be fetched. I do loop over the list and for each pair I execute following:
firestore.doc("/customers/" + customerId + "/products/" + productId).get().then(data => console.log(data));
Now, if the list of documents is small the data are fetched in reasonable time, but when there are more than 20 documents to be fetched the data for all documents are delayed and it takes 30-60 seconds (depends how many documents to be fetched).
In real scenario I'm not using .get in a loop, but instead I use AngularFire2 and Observable.combineLatest - but the results are the same: when simultaneously fetching many documents, it causes huge delays of getting the data.
The same thing but using admin-node-sdk worked without any issues.
Steps to reproduce:
Call .doc 50 times in a row, e.g.:
for (let i = 0; i < 50; i++) {
firestore.doc("/customers/" + i + "/products/" + i).get().then(data => console.log(data));
}