Sha256: 05f423879f3f2612b9c9967c8fe14b979819f4242e25ecd21bde551e1caa98d4
Contents?: true
Size: 781 Bytes
Versions: 2
Compression:
Stored size: 781 Bytes
Contents
class River include Mongoid::Document include Mongoid::Geospatial field :name, type: String field :length, type: Integer field :average_discharge, type: Integer field :source, type: LineString, spatial: true # set return_array to true if you do not want a hash returned all the time field :mouth, type: Point, spatial: {lat: 'latitude', lng: 'longitude'} field :mouth_array, type: Array, spatial: {return_array: true} # simplified spatial indexing # you can only index one field in mongodb < 1.9 spatial_index :source # alternatives # index [[ :spatial, Mongo::GEO2D ]], {min:-400, max:400} # index [[ :spatial, Mongo::GEO2D ]], {bit:32} # index [[ :spatial, Mongo::GEO2D ],:name] end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongoid_geospatial-2.2.0 | spec/models/river.rb |
mongoid_geospatial-2.0.0 | spec/models/river.rb |