How to save GeoPoint in Firebase Cloud Firestore?
I struggled to find out the right import/require. This is what worked for me !!
const firebaseAdmin = require('firebase-admin');
//other code ....
//assigning value to myLocation attribute
let newObject = {
otherAttribute:"otherAttributeValue",
myLocation: new firebaseAdmin.firestore.GeoPoint(latitude,longitude)
}
The Firestore SDKs include a GeoPoint class
, so you would have to save locations like this:
{
location: new firebase.firestore.GeoPoint(latitude, longitude)
}