1

With a structure like this:

.doc Name
   .colection 1
       .doc sub_doc
           .colection sub_col1
              .doc sub_doc
   .colection 2
       .doc sub_doc

How can I clone the document(with all of the sub collections etc) in to a new document in Firestore? Basicly creating a 1:1 copy of the document.

Is this a matter of querying the entire document first and rebuilding it from there?

Thanks in advance.

jACK
  • 147
  • 1
  • 14
  • If you're looking for a solution in NodeJS, I've added it here https://stackoverflow.com/a/73948157/9788634 – JuroOravec Oct 04 '22 at 12:56

1 Answers1

2

There is no built-in operation to clone a document or collection. You will have to read the document/collection through the API and write the copy through that too.

Also see:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807