2

Mongoid 3.1.4Rails(3.2.13)アプリに使用して、MongoDBとMongoidを初めて使用します。レガシ コードで、参照モデルにtype: Moped::BSON::ObjectIdとどこか の両方を使用している人々を見ました。type: String

class Team
  include Mongoid::Document

  field :room_id, type: String
  field :leader_id, type: Moped::BSON::ObjectId

  ...
end

( git blameI know these 2 lines written by 2 different people)

検索を行いましたが、いつ/なぜどのタイプを使用するのかという質問に対する答えが見つかりませんでした? StringまたMoped::BSON::ObjectId

ありがとう、

4

1 に答える 1