0%

紀錄一下MongoDb語法

紀錄一下MongoDb語法

1
2
3
db.supplyPoints.find({ Location:
{ $geoWithin:
{ $centerSphere: [ [ 121.57501, 25.07812 ], 5 / 3963.2 ] } } })
1
2
3
4
db.supplyPoints.createIndex({ Location: "2dsphere" })

var METERS_PER_MILE = 1609.34
db.supplyPoints.find({ Location: { $nearSphere: { $geometry: { type: "Point", coordinates: [ 121.57501, 25.07812 ] }, $maxDistance: 5 * METERS_PER_MILE } } })