0

I have an app with couple of screens. First screen shows data related to a collection and its document. Second screen show what is inside that document and shows it's all list of documents. And so on. It can be 7-8 level deep like this or more. But total amount of database size will never be greater than 500kB.

When the internet goes on and off and I'm in a screen, whose documents have never been read before, Users will see nothing as firebase caches data only after it has been queried once.

So, I want to download all the necessary data when the app starts or just the data for the first screen and lazy load all the data in the background immediately after that.

So, main question is, how can I get all data of a child at once as all firestore queries are shallow? and if a lazy load just after the first screen is shown, what is the better approach?

I've already seen this SO question, it doesn't help and it is old. And firestore as updated a lot in the meantime.

touhid udoy
  • 4,005
  • 2
  • 18
  • 31
  • Nothing has changed since that other question was asked. Queries are still shallow. You need to know all the names of all the collections and subcollections to query, and you'll need to query them each individually. – Doug Stevenson Oct 31 '19 at 10:17
  • @DougStevenson Okay, there are server comments, that suggested it is now possible after an update, but didn't say how. That's why I asked a new question. for example https://stackoverflow.com/questions/46875966/firestore-get-all-docs-and-subcollections-of-root-collection#comment103467923_46920923 – touhid udoy Oct 31 '19 at 10:35
  • If you are not querying across subcollections all with the same name, then a collection group query would not work for you. Please read carefully about what collection group queries can actually do. They are not deep queries. – Doug Stevenson Oct 31 '19 at 10:38
  • Thanks for the clarification, I'll read more on collection group then. – touhid udoy Oct 31 '19 at 10:39

0 Answers0