我有一个像这样的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
甚至可能吗?