通过将
strict: false选项作为第二个参数提供给
Schema构造函数,将该选项应用于您现有的模式定义:
var appFormSchema = new Schema({ User_id : {type: String}, LogTime : {type: String}, feeds : [new Schema({ Name: {type: String}, Text : {type: String} }, {strict: false}) ]}, {strict: false});module.exports = mongoose.model('appForm', appFormSchema);如果您想保留
feeds为完全无架构,则可以在其中使用
Mixed:
var appFormSchema = new Schema({ User_id : {type: String}, LogTime : {type: String}, feeds : [Schema.Types.Mixed]}, {strict: false});module.exports = mongoose.model('appForm', appFormSchema);


