Sha256: 65bc8a6c7b348d6864078ebe593bfcd7927002cc0c1fbb5e1bc87597afe04736

Contents?: true

Size: 783 Bytes

Versions: 19

Compression:

Stored size: 783 Bytes

Contents

class River
  include Mongoid::Document
  include Mongoid::Spacial::Document

  field :name,              type: String
  field :length,            type: Integer
  field :average_discharge, type: Integer
  field :source,            type: Array,    spacial: true
  # set return_array to true if you do not want a hash returned all the time
  field :mouth,             type: Array,    spacial: {lat: 'latitude', lng: 'longitude'}
  field :mouth_array,       type: Array,    spacial: {return_array: true}

  # simplified spacial indexing
  # you can only index one field in mongodb < 1.9
  spacial_index :source
  # alternatives
  # index [[ :spacial, Mongo::GEO2D ]], {min:-400, max:400}
  # index [[ :spacial, Mongo::GEO2D ]], {bit:32}
  # index [[ :spacial, Mongo::GEO2D ],:name]
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
mongoid_spacial-0.2.17 spec/models/river.rb
sig_mongoid_spacial-0.2.17 spec/models/river.rb
cb_mongoid_spacial-0.2.16 spec/models/river.rb
mongoid_spacial-0.2.16 spec/models/river.rb
mongoid_spacial-0.2.13 spec/models/river.rb
mongoid_spacial-0.2.12 spec/models/river.rb
mongoid_spacial-0.2.11 spec/models/river.rb
mongoid_spacial-0.2.10 spec/models/river.rb
mongoid_spacial-0.2.8 spec/models/river.rb
mongoid_spacial-0.2.7 spec/models/river.rb
mongoid_spacial-0.2.6 spec/models/river.rb
mongoid_spacial-0.2.5 spec/models/river.rb
mongoid_spacial-0.2.4 spec/models/river.rb
mongoid_spacial-0.2.3 spec/models/river.rb
mongoid_spacial-0.2.2 spec/models/river.rb
mongoid_spacial-0.2.0 spec/models/river.rb
mongoid_spacial-0.1.1 spec/models/river.rb
mongoid_spacial-0.1.0 spec/models/river.rb
mongoid_spacial-0.0.1 spec/models/river.rb