몽고이드에서 두 모델 간의 관계에 외래 키가 명시 적으로 필요합니까? 예를 들어.외래 키 및 몽고이도
class User
include Mongoid::Document
has_many :posts
end
class Post
include Mongoid::Document
belongs_to :user
# Is this necessary below?
field :user_id, type: Integer
end
몽고이 사이트의 문서는 내가 묻는 이유를 논의 할 때 필드의 선언을 나타내지 않습니다.