longitude
2016-09-19 09:33
253 查看
确保有loc:[longitude, latitude]属性
给loc增加索引AttractionSchema.index({loc: '2d'});
使用geoNear
db.places.find(
{
location: {
$nearSphere: {
$geometry: {
type : "Point",
coordinates : [ -73.9667, 40.78 ]
},
$minDistance: 1000,
$maxDistance: 5000,
}
}
}
)
spherical: true
给loc增加索引AttractionSchema.index({loc: '2d'});
使用geoNear
db.places.find(
{
location: {
$nearSphere: {
$geometry: {
type : "Point",
coordinates : [ -73.9667, 40.78 ]
},
$minDistance: 1000,
$maxDistance: 5000,
}
}
}
)
spherical: true
相关文章推荐
- python编码 2016.09.18回顾
- ubuntu 16.04下的latex的 section没有编号的问题
- adb报:adb server version (31) doesn't match this client (36); killing... 错误
- memcache java解读
- 如何分析android的OOM,与java静态代码分析工具
- 元数据
- WinServer2008配置任务计划
- Android Handler 的使用
- STM32 IO口的8中配置方式解读(推挽输出、开漏输出、复用开漏输出、复用推挽输出以及上拉输入、下拉输入、浮空输入、模拟)
- NSTimer的两种创建方式以及跟RunLoop的简单结合使用
- Disruptor介绍
- Java算法-冒泡排序
- 无废话MVC入门教程二[第一个小Demo]
- iOS CoreData 增删改查详解
- 浅析Node.js是什么以及工作原理
- python之模块
- ThinkPHP3.2.3新特性之:数据库设置
- apache加入chkconfig
- 解决eclipse卡在启动页面
- 基于Java中Math类的常用函数总结