认证登陆:
db.auth("yxg","yxg")
插入gps数据1
> db.address_info.insert( { loc : { type: "Point", coordinates: [ 121.466349,
31.2226834 ] }, name: "北海公园", category : "公园" } ))
插入gps数据2
78 ] }, name: "La Guardia Airport", category : "机场" } )
为gps数据做2dsphere索引
> db.address_info.ensureIndex( { loc : "2dsphere" } )查询 [120.261277, 30.317512] 的附近500的工具
> db.address_info.find( { loc : { $near : { $geometry : { type : "Point" , coord
inates : [120.261277, 30.317512] } , $maxDistance : 500} } })