ryanong/mongoid_spacial

dont work, but no reason

Closed this issue · 2 comments

Hi,

I'm having a strange issue, ive already ran

rake db:mongoid:create_indexes

but when i try to use spacial functions (any of them, like geo_near, ;field.where([]) ), i always get this error ;

Mongo::OperationFailure: can't find special index: 2d for: { location: { $near: [ 37.761523, -122.423575 ] } }

here's my model

class Place

include Mongoid::Document
include Mongoid::Spacial::Document

field :name,type: String
field :street,type: String
field :postal_code,type: String
field :city,type: String
field :location, type: Array, spacial:true
has_many :parties

end

Dont know what to do , i've already used this gem in production with no trouble , but i can't find how this error is thrown.

Im using ruby-1.9.3, rails 3.1, mongo 2.0.2

thanks

ok no explanation , but when i create the index in the mongo-cli , it works well, the problem must be inside the rake task , tell me if you want to investigate ....

I am having this same issue. What is the fix?