Iphone Appcelerator钛ACS按离用户最近的位置订购
我正试着按最近的地方在名单上点菜。这可以很好地使用此代码:Iphone Appcelerator钛ACS按离用户最近的位置订购,iphone,cloud,titanium,appcelerator,Iphone,Cloud,Titanium,Appcelerator,我正试着按最近的地方在名单上点菜。这可以很好地使用此代码: Cloud.Places.query({ page: 1, per_page: 20, where: { lnglat: { '$nearSphere': [latitudefast,longitudefast], } }, order: { lnglat: { '$nearSphere': [latitudefast,longitudefast], } }, latitudefast和L
Cloud.Places.query({
page: 1,
per_page: 20,
where: {
lnglat: { '$nearSphere': [latitudefast,longitudefast], }
},
order: {
lnglat: { '$nearSphere': [latitudefast,longitudefast], }
},
latitudefast和LongtudeFast表示用户的实际位置。它在查询之前已定义
但是它是“颠倒的”,这意味着最近的位置在列表的底部,而最远的位置在列表的顶部!怎么会?我该如何反向订购?我点错菜了吗?
谢谢 您是否尝试过不指定订单$默认情况下,nearSphere返回按距离排序的结果 来自MongoDB的文档(ACS将其用作其数据存储),描述$near: 上面的查询找到最接近(50,50)的点并返回它们 按距离排序(无需额外排序 参数) 这也适用于$nearSphere