Duplicate object Firestore console
Asked Answered
T

3

11

I need to duplicate a few items in the Firebase Firestore console. I tried, but there seemed to be only two options: Delete the document and Delete all fields.

Is there a option to duplicate an object in the console?

Tangerine answered 7/1, 2021 at 13:50 Comment(0)
I
7

There is no feature in the Firebase console to duplicate a Firestore document. If you think that'd be a useful feature for many user, you could file a feature request for it.

For now the easiest way to duplicate a document's contents is probably to write a small Node.js script for it.

Iraidairan answered 7/1, 2021 at 15:59 Comment(2)
Do you have a simple solution to duplicate a document with a Node.js script? I am an iOS Developer and can't program in Java script.Tangerine
Oh, in that case you can do the same in Swift/ObjC. I typically have a admin panel in my apps (or a separate admin app altogether) where this could fit quite well too.Iraidairan
J
25

Here is how you can do it:

  1. From "More in Google Cloud", choose any of the options listed. This will take you to a Google Cloud Console for Firestore.
  2. Go to "Firestore Studio" section in the left side panel and click on the Document actions (three dots showing after the document id in the panel).
  3. There is the "Add similar document" which allows you to duplicate the document.
Judas answered 1/9, 2023 at 5:6 Comment(3)
This should be the accepted answer. To help save people time finding it...the "More in Google Cloud" referenced here is a drop down on the upper right of your Firestore Console. Follow Basil's steps (above) from there, it works great.Profanatory
Thanks a lot. I don't know why the still not bring this feature to FirebaseGabbi
For those that just want a quick link: console.cloud.google.com/firestore/databases/-default-/data/…Pulsatory
I
7

There is no feature in the Firebase console to duplicate a Firestore document. If you think that'd be a useful feature for many user, you could file a feature request for it.

For now the easiest way to duplicate a document's contents is probably to write a small Node.js script for it.

Iraidairan answered 7/1, 2021 at 15:59 Comment(2)
Do you have a simple solution to duplicate a document with a Node.js script? I am an iOS Developer and can't program in Java script.Tangerine
Oh, in that case you can do the same in Swift/ObjC. I typically have a admin panel in my apps (or a separate admin app altogether) where this could fit quite well too.Iraidairan
D
0

I dont if it is useful but it worked for me,

i am using the Firebase Realtime Database,

while on the current node just export the json and create new node then paste the downloaded json data as the option of object.

Dix answered 11/3, 2023 at 7:37 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.