Closed aponski closed 3 years ago
I found a few problems with this issue:
Can you share you code? One possibility might that you are using JSON.stringify()
before sending the data to the SDK.
I'm using axios to make a request
const payload = {
geoPoint: new admin.firestore.GeoPoint(latitude, longitude),
}
const response = await axios(
{
method: 'post',
baseURL: baseApiUrl,
url: '/address',
params: {
api_token: apiToken
},
headers: {
'Content-Type': 'application/json',
},
responseType: 'json',
data: paylod
}
)
Our types are only supported if you use the Admin SDK to write to the backend. If you are using the REST API, you have to manually serialize your data to the Protobuf REST representation (which can be quite a bit of work).
See details here: https://firebase.google.com/docs/firestore/use-rest-api
Describe the problem
In a cloud function I'm constructing geopoint using
new admin.firestore.Geopoint(0, 0)
and store it in firestore. However it is not properly recognised when viewing in the firestore UI browser. It is shown as simple object {_latitude: 0, _longitude: 0}.When I construct geopoint in a frontend web app using
new firebase.firestore.GeoPoint(0, 0)
it is shown ok in firestore UI browser as [0° N, 0° E].