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

Date import

Open aknuth opened this issue 7 years ago • 9 comments

exporting a Date/Timestamp Field from Firebase lead to e.g. an {"start":"2018-08-26T12:00:00.000Z"} and vice versa importing this into firebase marks this field as string ... does the script excepts any other date pattern ? or is this a bug ?

aknuth avatar Aug 26 '18 22:08 aknuth

Hi @aknuth, you're right, in it's current form. There is a waiting pull request which sorts this out for Timestamp and the other Firestore types such as Geopoint, Doc Reference, etc.

stildalf avatar Aug 27 '18 06:08 stildalf

thanks for your quick reply. So let's wait for the pulll request to be merged. Meanwhile I'll take your implementation ...

aknuth avatar Aug 27 '18 08:08 aknuth

PR has been merged, and I've updated and tried the following:

{"tsfield":"2018-08-26T12:00:00.000Z"} {"tsfield":{"type":"timestamp", "data":"2018-08-26T12:00:00.000Z"}}

The first is imported as a string, the second as an object. Anyone have a tip?

acrollet avatar Sep 26 '18 14:09 acrollet

For JSON you'll need to enclose your value in double quotes, and escape where needed, so: {"tsfield":{"type":"timestamp", "data":"2018-08-26T12:00:00.000Z"}} to: {"tsfield":"{\"type\":\"timestamp\", \"data\":\"2018-08-26T12:00:00.000Z\"}"}

Looking at that also gives me the creeps, I'll see what can be done there.

stildalf avatar Oct 09 '18 06:10 stildalf

confirm this works, thanks!

acrollet avatar Oct 25 '18 15:10 acrollet

Hi there,

New on this, I'm trying import .json to my firestore and after install npm (I followed instructions) I tried fire-migrate import and says "fire-migrate" or "import" are no valid commands. What I'm doing wrong? Need a hand. Thanks in advanced.

Ivanmocadaes avatar Nov 03 '18 12:11 Ivanmocadaes

this looks like has already been fixed, can someone please close this ticket? thanks!

samiq avatar Dec 12 '18 11:12 samiq

Hi there,

New on this, I'm trying import .json to my firestore and after install npm (I followed instructions) I tried fire-migrate import and says "fire-migrate" or "import" are no valid commands. What I'm doing wrong? Need a hand. Thanks in advanced.

Hi everyone, I have the same problem. How did you solve it? Thank you!

Mickind avatar Dec 20 '18 21:12 Mickind

hello there,

So, I am using the the fire-migrate import command and assign my own doc id.

fire-migrate import --id u missing.csv Articles

now when I try to search the data for a certain ID using an IOS app, it cannot find it. When I try to add the article through my app, it refreshes this record that got uploaded and updates the doc ID. after this step, the app is able to locate the article. There seems to be some issue with how doc ID is written during the upload process.

I have a video that I can show which shows the record update process in firestore. I really cannot see what changed, but it clearly seems to update the doc ID apart from some few document fields which is understandable.

basementaspirations avatar Jan 03 '19 23:01 basementaspirations