????4???????????????Schema??Model????Щ???????????????????·???′??????models??????У???????????user.js??????????????models/user.js?????????
????var mongoose = require('mongoose')
?????? Schema = mongoose.Schema
?????? ObjectId = Schema.ObjectId;
????var UserSchema = new Schema({
????name: String
?????? password: String
????});
????module.exports = mongoose.model('User'?? UserSchema);
??????????У???????????UserSchema??Model?????????????????????UserSchema??module.exports = UserSchema??????????????????????????????????????Model????
????5??????mongoose????????????????????view??????????????????????Щ?????????????????????????????????·???/reg?????????????????????????????name="user[]"?????????????????????????????user????????????????????????????
????<% include header.ejs %>
????<form action="/reg" method="post">
????<input type="text" name="user[name]" />
????<input type="password" name="user[password]" />
????<input type="submit" value="Register" />
????</form>
????<% include footer.ejs %>
?????????????doReg??????????????????????????