gq

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 5 Imported by: 1

README

Geospatioal Query Operators

https://www.mongodb.com/docs/manual/reference/operator/query-geospatial/

GeoIntersects

image

Pada dokumen mongo :

{
  <location field>: {
     $geoIntersects: {
        $geometry: {
           type: "<GeoJSON object type>" ,
           coordinates: [ <coordinates> ]
        }
     }
  }
}

Query mongosh :

db.lokasi.find(
   {
     batas: {
       $geoIntersects: {
          $geometry: {
             type: "Point" ,
             coordinates: [ 107.57569081895566, -6.8735086203166285 ]
          }
       }
     }
   }
)

Implementasi Golang :

filter := bson.M{
  "batas": bson.M{
   "$geoIntersects": bson.M{
    "$geometry": bson.M{
     "type":        "Point",
     "coordinates": []float64{long, lat},
    },
   },
  },
 }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeoIntersects

func GeoIntersects(mongoconn *mongo.Database, long float64, lat float64) (namalokasi string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL