ボクココ

個人開発に関するテックブログ

mongoid で インデックス貼るときにエラー


$
rake db:mongoid:create_indexes

13027: point not in range

the index declaration in the model is index :location, Mongo::GEO2D , :min => 200, :max => 200

こんなエラーがでた。調べてみると、minが200でmaxが200ってどう考えてもおかしいよなw ということで min を -180, maxを180に修正して解決した。


コマンドメモ


rake db:mongoid:create_indexes

Locations.where(:location => {"$near" => [__.____, __.___], '$maxDistance' => 1.fdiv(111)}).to_a