mongoid/mongoid-geospatial

Rails 4?

Closed this issue · 4 comments

Is there any plan for Rails 4 support?

Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    mongoid_geospatial (>= 0) ruby depends on
      activemodel (~> 3.1) ruby

    rails (= 4.0.0) ruby depends on
      activemodel (4.0.0)

I am currently trying it out with Rails 4 and Mongoid 4.

Try adding following to gemfile:
gem 'mongoid_geospatial', github: 'nofxx/mongoid_geospatial', branch: 'master'

Created a new gem version. 2.8.3
Lots of changes to be coming with mongoid 4 and mongodb new features!

Great. Was trying it out for following type queries. Will come in handy once I get familiar with mongodb geospatial stuff.

Van.where({:'origin.coordinates' => {"$within" => {"$centerSphere" => [origin, (origin_radius.fdiv(3959))]}}, '$and' => [{:'destination.states'.in => [state]}, "$or" => {:'destination.coordinates' => {"$within" => {"$centerSphere" => [dest, (dest_radius.fdiv(3959))]}}}]})

It works for now though.

edit: actually "$or" doesn't work with mongodb geospatial queries

http://docs.mongodb.org/manual/reference/operator/query/or/

oh well.

Rails 4 working ok.

@unkleara the idea is that in ruby, currently moped removed almost every 2d query, there's only sphere. I'm going to document this, but not going to write any code as mongoid 5 will drop moped.