The origin of this gist: https://blog.cloudboost.io/copy-export-a-cloud-firestore-database-388cde99259b
The schema is for example only, it's must be modified according to the firestore database.
Quoting Bruno Braga
"this schema is how your DB is organized in a tree structure. You don't have to care about the Documents but you do need to inform the name of your collections and any subcollections, in this case we have two collections called users and groups, the all have their documents, but the collection users has its own subcollections, friends and groups, which again have their own subcollection, messages."
For any doubt, add it here, but let me know by email that the question has been added, I usually go unnoticed when someone comments here.
Workaround for dates:
Then add
doc_data = fixDates(doc_data);
right before setting the data