Search code examples
firebasegoogle-cloud-firestoresupabase

How to migrate 'sub-collection' of fireStore to supabase?


I tried to migrate fireStore db to supabase.

The process for this is documented well in official documents:
https://supabase.com/docs/guides/resources/migrating-to-supabase/firestore-data

But when I run node collections.js to list all collections of fireStore, it shows all collections only.
fireStore has concept subCollection and I want to make it as separate Table in postgreSQL.

Even if that's not the case, I need to fetch data from sub-collection from fireStore.

Is it impossible now?


Solution

  • When you [construct your .js file](module.exports = (collectionName, doc, recordCounters, writeRecord) => { // modify the doc here return doc }), can you try to provide the sub-colleection path to collectionName, something like myCollection/documentId/mySubcollection

    module.exports = (collectionName, doc, recordCounters, writeRecord) => {
      // modify the doc here
      return doc
    }