jloosli / node-firestore-import-export

Firestore data import and export
https://www.npmjs.com/package/node-firestore-import-export
MIT License
388 stars 78 forks source link

Wrong geopoint, and timestamp data types when exporting. #18

Closed pollo17385 closed 6 years ago

pollo17385 commented 6 years ago

Expected behavior

The result of exporting geopoint, and timestamp data types are fields of the same types.

Actual behavior

When I export my database from collectionA/document1/

Within document1 I have 1 more collection that contain geopoint, and timestamp data types that are exported correctly. But I also have fields within document1 that have geopoint (latlng), and timestamp (createdAt, updatedAt) data types that are exported as arrays.

Attached is image of the JSON resulting from the export. Thank you very much.

export-json

Steps to reproduce the behavior

jloosli commented 6 years ago

That's really strange...I've tried recreating this a few different ways and haven't been able to. What version of the node library are you using?

pollo17385 commented 6 years ago

It's strange, I tried several times and had the same result. My version of node is v8.9.4

jloosli commented 6 years ago

@pollo17385 Sorry...I meant for the node-firestore-import-export...the current version is 0.8.1. If some of the exported fields are exporting correctly, I'm guessing you're on at least 0.8.*.

Just to double check, when you hover over those fields in the firebase console, does it show (timestamp) and (geopoint) (see image below) ? In earlier versions of this library, I didn't separate out geopoints and timestamps correctly, so I would export them and they'd export as either a plain JSON object (geopoint) or string (timestamp), then if I reimported them, they would overwrite the actual datatypes. I'm wondering if you did some exporting/importing with an earlier version of this library and it overwrote the datatypes for those fields?

screenshot-console firebase google com-2018 05 15-17-03-53

If that's not the case, can you share a smallish snippet of the exported data in a gist or something so I can try importing and exporting that?

pollo17385 commented 6 years ago

@jloosli sorry, the version is 0.8.1., and yes when I hover over those fields in the firebase console, they show (timestamp) and (geopoint).

In this link I leave you the .json file of the exported example:

https://drive.google.com/file/d/1NiXJcJ9AjTze2YxvpQmPrf9hdwmPkd25/view?usp=sharing

Thank you very much!

jloosli commented 6 years ago

@pollo17385 thanks for sending me the data. Everything seemed to work correctly both importing and exporting the whole set of data, but now I see that when exporting a single document (e.g. using the option -n menu/yMlLxZAt9WzW7Mpp5kD9 on the data you sent), it is not handling those classes correctly within the fields of the base document. Does that seem to be what you're seeing?

I'll dive into it and get back to you.

jloosli commented 6 years ago

@pollo17385 This should be fixed in version 0.8.3. Try that and let me know if you see any problems.

pollo17385 commented 6 years ago

@jloosli Thanks for your fast solution. I'll try it again and let you know if it's solved. Thank you very much!

pollo17385 commented 6 years ago

@jloosli I see that in https://www.npmjs.com/package/node-firestore-import-export#data-format is still in 0.8.1. Thats ok?

jloosli commented 6 years ago

That's OK. I need to update the readme with a more detailed view of the special data formats, but the underlying libary should work correctly.

pollo17385 commented 6 years ago

@jloosli I just tested the new version and it does fix the problem. Again I thank you for your speed of response and for taking the time to fix it. Greetings from Uruguay, Gonzalo.