【发布时间】:2022-11-22 10:17:54
【问题描述】:
我在将 Firestore Geopoint 保存到 Json 文件时遇到问题。在我的 flutter 应用程序中,我这样保存 Geopoint。
FirebaseFirestore.instance.collection('ZayyanProperties').get().then(
(value) => value.docs.forEach(
(element) {
var docRef = FirebaseFirestore.instance
.collection('ZayyanProperties')
.doc(element.id);
docRef.update({
'b18-geopoint': GeoPoint(16.00001, 96.00001)
});
Geopoint 的值正确存储在 Firestore 数据库中。请看我的 Firestore 数据库的截图here
我的问题是,当 Geopoint 作为 Json 保存到 Algolia 时,它没有正确保存。在Algolia的Json文件中,Firestore Geopoint保存为
"_geoloc": {
"lat": 16.00001,
"lng": 96.00001
},
但是,我认为它应该像这样保存??
"b18-geopoint": {
"lat": 16.00001,
"lng": 96.00001
},
请查看 Algolia Json here 的截图
所以,我的问题是如何在 Json 中正确保存 Geopoint?
先感谢您。 最好的
【问题讨论】:
-
如果你想让 algolia 识别你的 lat/lng,那么你必须遵循 algolia 的要求。 algolia 需要
"_geoloc"而不是“b18-geopoint”。
标签: json flutter google-cloud-firestore algolia