title: Cloud Functions: How to copy Firestore Collection to a new document?
body: <p>I'd like to make a copy of a collection in Firestore upon an event using Cloud Functions</p>
  
  <p>I already have this code that iterates over the collection and copies each document</p>
  
  <pre class="lang-js prettyprint-override"><code>const firestore = admin.firestore()
  firestore.collection("products").get().then(query =&gt; {
    query.forEach(function(doc) {
      var promise = firestore.collection(uid).doc(doc.data().barcode).set(doc.data());
    });
  });
  </code></pre>
  
  <p>is there a shorter version? to just copy the whole collection at once?</p>