Forms-mongoose allows auto-generation of forms from your Mongoose models
http://search.npmjs.org/#/forms-mongoose
Example
Mongoose
var mongoose = ;var Schema = mongooseSchema;var Email = mongooseSchemaTypesEmail;var forms = ; var AddressSchema = category: type: String required: true default: 'home' forms: all:{} lines: type: String required: true forms:all:widget:formswidgets city: type: String required: true ; var PersonSchema = email: type: Email unique: true forms: all: type: 'email' confirmed: type: Boolean required: true default: false name: first: type: String required: true forms: new: {} edit: {} last: type: String required: true forms: new: {} edit: {} address: AddressSchema; var PersonModel = mongoose;
Convert Mongoose Model to Forms Object
var forms = ; var form = forms; // Creates a new form for a "new" Person // Use the form object as you would with Forms console;// Note toHTML does not include the <form> tags, this is to allow flexibility. //optionally create some static methods in the schema PersonSchemastatics { return forms;} PersonSchemastatics { return forms;}
Requirements
Installation
npm install forms-mongoose