2012-07-04 3 views
2

나는 엄청난 일을 잘못하고 있고, 내가 뭘 잘못하고 있는지 확신 할 수 없다. Mongo에 상당히 새로운 것Mongo/Rails Mongoid 인덱스가 포함 된 필드

MongoDB와 Mongoid와 함께 Rails 3.2.6을 사용한다. 삽입 된 입력란에 색인을 추가하려고합니다.

나는 'Referals'가 내장 된 'Scheme'모델을 가지고 있습니다. "Referal"에는 'to_code'(문자열) 필드가 있습니다. 이 필드의 색인을 생성하려고합니다.

class Scheme 
    include Mongoid::Document 
    include Mongoid::Timestamps 
    embeds_many :referals 
    index "referals.to_code" => 1 

class Referal 
    include Mongoid::Document 
    include Mongoid::Timestamps 
    embedded_in :scheme 

내가 '레이크 DB : mongoid : create_indexes'실행이이 오류와 함께 실패 지금까지 내가이 정확히 Mongoid 문서를 다음과 말할 수

Not a Mongoid parent model: app/models/referal.rb 
rake aborted! 
Invalid index specification {"referals.to_code"=>1}; should be either a string, symbol, or an array of arrays. 

, 나는 '어떻게 그렇게 확신하지를 잘못하고있다. 도움을 주시면 감사하겠습니다.

답변

관련 문제