Sha256: 515818e564236029086e119a433140e044bc3257cdf63429c5c79e29c6d83b54
Contents?: true
Size: 812 Bytes
Versions: 2
Compression:
Stored size: 812 Bytes
Contents
# Sample spec class class River include Mongoid::Document include Mongoid::Geospatial field :name, type: String field :length, type: Integer field :discharge, type: Integer field :course, type: LineString, spatial: true # set return_array to true if you do not want a hash returned all the time field :source, type: Point, spatial: true 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-5.1.0 | spec/models/river.rb |
mongoid-geospatial-5.0.0 | spec/models/river.rb |