ฉันมีโครงการ mongoDB บางอย่างเช่นนี้
new Schema({
productDetail: [ {
productYear: String,
productNumber: String,
productType: [ { type: Schema.ObjectId, ref: 'type' } ]
} ],
created_at: string
)}
เมื่อลองแบบเดียวกันใน Rails และ mongoid ฉันไม่สามารถเพิ่มองค์ประกอบลูกและประเภทข้อมูลให้กับวัตถุ Hash ได้
class Product
include Mongoid::Document
has_many :types
field :productDetail, type: Hash
field :created_at, type: string
end
เป็นไปได้ไหม?