28 likes
·
10.5K reads
4 comments
shouldn't at least the moveDoc function wrap the operations in a transaction?
Seems strange that you are going to delete document that can be changed during the operation.
But even in that case the read operation is done once and the newly created document will have the content at this moment. No transaction needed.
And if youare expecting the write operation in the result document... all of the content will be overwritten.
Generally, make sure, that you are not working with actively used documents. Otherwise a whole bunch of errors can happen: loss of data, update of non-existing documents and so on. Or... change the functions to handle all the cases: only copy, but not move and create the new doc at least with merge option, but better check if the doc exists and merge the data with some custom logic.
You should include your thesis statement into your introduction paragraph. It should unite all your arguments https://educibly.com/ . Here are some main tips that will help you deal with such specific paper as 5 paragraph essay.
For "Copy" script, shouldn't there be
// get all the documents in the collection
await subcollectionRef
instead of
// get all the documents in the collection
return await subcollectionRef
when copying recursively?
Return value in for..of means that iterator will finish. So only the first subcollection will be copied. Or maybe I'm missing something.