如何在Firebase Cloud Firestore的集合中查询最近的GeoPoints? [英] How to query closest GeoPoints in a collection in Firebase Cloud Firestore?
本文介绍了如何在Firebase Cloud Firestore的集合中查询最近的GeoPoints?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如,如果我的每个集合文档都有一个位置
geopoint
类型的字段。
如何获得最近的10个文档到任意的坐标?
文档似乎没有涉及到这一点。我试过这样的东西:
someRef.where('location','>',geopoint).limit(10) 。得到();
显然这没什么意义,但我只是在这里尝试一些东西
The new Firestore DB allows me to store GeoPoints. Is there a way to query based on them?
So for example if each of my collections documents got a location
field of the type geopoint
.
How can I get the closest 10 documents to an arbitrary coordinate?
The documentation doesn't seem to cover this. I tried stuff like this:
someRef.where('location', '>', geopoint).limit(10).get();
Obviously this doesn't make much sense but I'm just trying out some stuff here
这篇关于如何在Firebase Cloud Firestore的集合中查询最近的GeoPoints?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文