I have read the documentation here talks about writing query to get some location within the radius:
db.restaurants.find({ location:
{ $geoWithin:
{ $centerSphere: [ [ -73.93414657, 40.82302903 ], 5 / 3963.2 ] } } })
Now I try to write it using mgo
driver but I don't get the idea how to write it here what I have tried :
var cites []City
collection := mongo.DB("Db").C("Collection")
err = collection.Find(bson.M{
"location": bson.M{
"$geoWithin": bson.M{
"$centerSphere" : [ [ -73.93414657, 40.82302903 ], 5 / 3963.2 ],
},
},
}).All(&cites)
Yes above code absolutely not working becuase I don't know how to translate this [ [ -73.93414657, 40.82302903 ], 5 / 3963.2 ]
in go?