You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Start exporting your datafirestoreService.restore(`./collections/${collectionName}.json`,{dates: ['notifications.date']});
I cannot get it to restore it as a timestamp. It restores as a map field.
I have also tried with 'notifications[].date' and simply 'date' unsuccessfully.
Any help is greatly appreciated. Thanks.
The text was updated successfully, but these errors were encountered:
Hi @evallgar, an object of data under array is not supported yet. I will figure a solution to solve this. You can check the code and make some changes to support this case if you want to contribute.
constapplyConversion=(data: any,conversion: Function,key: Array<string>)=>{if(!key||key.length===0)return;if(Array.isArray(data)){data.forEach(d=>applyConversion(d,conversion,key));return;}if(!data.hasOwnProperty(key[0]))return;if(key.length===1){consttheKey: string=key[0];constcheckResult=conversion(data[theKey]);if(checkResult)data[theKey]=checkResult;}elseif(isObject(data)){applyConversion(data[key[0]],conversion,key.splice(1));}}//gives the properties of data, specified by keys, to conversion; keeps old value of conversion returns null, else replaces value with return value of conversionexportconstconvertProperty=(data: any,conversion: Function,keys: Array<string>)=>{keys.forEach((key: string)=>{applyConversion(data,conversion,key.split('.'));});}
and replace the relevant part (line 132) in import.ts with
// Update date valueif(options.dates&&options.dates.length>0){convertProperty(data,makeTime,options.dates)}
(similarly for refs and and geos), that should do the trick. I've tested it only with one set of data though.
In the above example you'd use 'notifcations.date' to get the desired result; the layer of the array in the JSON tree basically gets skipped.
Hi there!
I would like to ask how to correctly use restore for date timestamp when data looks like this:
When I use the command
I cannot get it to restore it as a timestamp. It restores as a map field.
I have also tried with
'notifications[].date'
and simply'date'
unsuccessfully.Any help is greatly appreciated. Thanks.
The text was updated successfully, but these errors were encountered: