ryanong / mongoid_spacial

A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.
MIT License
138 stars 63 forks source link

dont work, but no reason #19

Closed geraudmathe closed 12 years ago

geraudmathe commented 12 years ago

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

geraudmathe commented 12 years ago

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 ....

twamble commented 12 years ago

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