firestore-migrator icon indicating copy to clipboard operation
firestore-migrator copied to clipboard

Enforce a schema or data shape on import

Open codediodeio opened this issue 7 years ago • 2 comments

Imagine you have a huge spreadsheet with many unnecessary fields or unwanted data types, you could define an object that would convert the data to the proper Firestore structure and set defaults for missing vals.

export const item = new Schema({
  name: { type: 'string', default: 'hello' }
  location: { type: 'geopoint' }
  date: { type: 'timestamp', default: new Date() } 
})

Then you run a command like fire-migrate items.csv items --schema item

codediodeio avatar Mar 31 '18 14:03 codediodeio

I like. This will indeed be necessary to encode/decode some Firestore specific types, like geopoint.

stildalf avatar Apr 01 '18 20:04 stildalf

where is the schema defined? in a file?

basementaspirations avatar Jan 04 '19 17:01 basementaspirations