dalenguyen / firestore-import-export

An application that can help you to backup and restore from Cloud Firestore | Firebase
https://www.npmjs.com/package/firestore-export-import
401 stars 109 forks source link

Firestore GeoPoint Field Not Importing/Exporting Properly #18

Closed Harin329 closed 5 years ago

Harin329 commented 5 years ago

The GeoPoint field is exported as a latitude and longitude, but when imported back into firestore, becomes a map with two numbers fields. Any fixes? Thanks in advance!

dalenguyen commented 5 years ago

@Harin329 can you provide more detail or the snapshot of what you did? Thanks,

Harin329 commented 5 years ago

This is the sample code. The GeoLocation is being added onto the JSON as so and when it's imported back onto cloud firestore, it is a map named "Location" with field 1 "_latitude" value 49.290683 and field 2 "_longitude" value -123.133956, rather than a proper geoPoint

{
  "Canada": {
    "Motomachi Shokudo": {
      "Menu": {
        "Appetizers": {
          "Chicken Chashu Rice": {
            "Raters": 1,
            "Price": 6,
            "Rating": 2.5
          }
        }
      },
      "Rating": 2.5,
      "Website": "www.google.com",
      "Location": {
        "_latitude": 49.290683,
        "_longitude": -123.133956
      },
      "Phone": "(604) 999-9999",
      "NumRates": 1,
      "Country": "Canada",
      "City": "Vancouver"
    }
  }
}
dalenguyen commented 5 years ago

Hi @Harin329, the script now supports GeoPoint fields. Please try it again.