Open francescopellegrini opened 3 years ago
Given an exported data as follows:
const data = { collection1: { docId: { refArray: [ {path:'collection1/document1-ref'}, {path:'collection2/document2-ref'} ] } } }
the refArray field gets parsed into 'collection2/document2-ref instead of an array of strings.
refArray
'collection2/document2-ref
This is because the field is completely overridden while looping on the original array.
https://github.com/dalenguyen/firestore-backup-restore/blob/62385dd250943acf67578698f23168dd2e0286ef/src/export.ts#L82-L84
The appropriate way of mapping the array values can be seen in import.ts:
import.ts
https://github.com/dalenguyen/firestore-backup-restore/blob/62385dd250943acf67578698f23168dd2e0286ef/src/import.ts#L173
Given an exported data as follows:
the
refArray
field gets parsed into'collection2/document2-ref
instead of an array of strings.This is because the field is completely overridden while looping on the original array.
https://github.com/dalenguyen/firestore-backup-restore/blob/62385dd250943acf67578698f23168dd2e0286ef/src/export.ts#L82-L84
The appropriate way of mapping the array values can be seen in
import.ts
:https://github.com/dalenguyen/firestore-backup-restore/blob/62385dd250943acf67578698f23168dd2e0286ef/src/import.ts#L173