I have an app that works on node.js with MongoDB and mongoose. My app simply sends/deletes/edits form data and for that, I have such mongoose model:
var mong
Apply the strict: false
option to your existing schema definition by supplying it as a second parameter to the Schema
constructor:
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);
If you want to leave feeds
as fully schemaless, that's where you can used Mixed
:
var appFormSchema = new Schema({
User_id : {type: String},
LogTime : {type: String},
feeds : [Schema.Types.Mixed]
}, {strict: false});
module.exports = mongoose.model('appForm', appFormSchema);