【发布时间】:2018-09-26 19:09:44
【问题描述】:
我似乎偶然发现了 GeoFire 的一个问题,因为我似乎无法过滤我的 GeoFire 查询。在我的平台上,用户创建帖子并使用 geofire 设置他们的位置,因此,可能有成千上万的帖子我不想在客户端过滤..
我想orderByChild('created') 和limitToLast('10') 这样在客户端不需要太长时间..
到目前为止我所拥有的是:
this.geoFire = new GeoFire(this.database.database.ref()
.child('location'))
this.geoFire.query({
center: [this.userLocation.lat, this.userLocation.lng],
radius: 7
})
.on('key_entered', (key, location, distance) => {
this.subscription = this.database.database.ref('/posts/'+key)
.orderByChild('created')
this.subscription.once('value', (snapshot) => {
this.postFeed.push(snapshot.val())
});
})
但这似乎不起作用。
我的位置数据库如下所示:
对于帖子:
我做错了什么?为什么我不能过滤orderByChild('score') or 'created'
【问题讨论】:
标签: javascript angular firebase geofire