0
私は、次のクエリを持っている:配列をパラメータとしてクエリし、GoLang mgoに変換する方法は?
db.getCollection('spawnlocations').find({
'location': {
'$geoWithin': {
'$center': [[-73.94075, 40.789138], 5000]
}
},
"expirationtimems": { "$gte": 1234567890 },
"_id": { "$gte": "2a920240836c40d8b374203a798a27fa.16" }
}).sort({"_id":1}).limit(50)
私はbson.M
を使用してMGOするクエリを変換しようとしていますが、私はそれの配列の一部で苦労しています。
q = bson.M{
"location": bson.M{
"$geoWithin": bson.M{
"$center": [
j.Location.Coordinates,
5000
],
},
},
"expirationtimems": bson.M{
"$gte": time.Now().Unix() * 1000,
},
"_id": bson.M{
"$gt": p,
},
}
「$ center」:interface [] {interface [] { - 73.94075,40.789138}、5000} '? –