templates/app/models/mongo-model.hbs
// This model was generated by Lumber. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
module.exports = (mongoose, Mongoose) => {
// This section contains the properties of your model, mapped to your collection's properties.
// Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const schema = Mongoose.Schema({
{{#each fields as |field|}}
{{wq field.name}}: {{#if field.ref}}{ type: {{field.type}}, ref: '{{field.ref}}' }{{else if (isObject field.type)}}{{>renderNested type=field.type level=2}}{{else}}{{field.type}}{{/if}},
{{/each}}
}, {
timestamps: {{timestamps}},
});
return mongoose.model('{{modelName}}', schema, '{{table}}');
};