I have a scenario in which I want to move my top level, in other words first, collection to the third level. Is the only way to go about this to use third party import-export software with manipulation to do this, or is there a firestore feature that I am missing? All help will be greatly appreciated.
TopLevel>Documents>ThirdLevel, where top level is the first collection in the db. Just to give a better picture of what I am trying to say.
After you set your project's default GCP resource location, you cannot change it. If you set up Cloud Firestore or Cloud Storage, you're prompted to select your project's default GCP resource location in the Firebase console workflow.
Before you use Cloud Firestore, you must choose a location for your database. To reduce latency and increase availability, store your data close to the users and services that need it. This location setting is your project's default Google Cloud Platform (GCP) resource location.
Create a copy of the source document in the target collection, i.e. read it from the source collection, get the document fields and create a new document in the target collection with these fields, and then; Delete the document from the source collection.
Firestore has no ability to move collections or documents. Instead, you can copy documents. You'll have to write code to read the contents of a document, then write those contents to a document in a new location, then delete the original document.
I know it's an old question, but just in case someone else needs this. It's now possible using google's cloud shell. Details available in this link: https://firebase.google.com/docs/firestore/manage-data/export-import
You have two options to export specific collections, modify them, then import them, or export the whole bucket, then import it back. As I understood you can't mix the operations for example export all and import specific collections.
Note: I believe you'll be charged for the read and write of all documents exported and imported. And billing must be activated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With