Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 444 Bytes

section53.2.md

File metadata and controls

25 lines (21 loc) · 444 Bytes

Section 53.2: Model

  • (ECMA 6)
import mongoose from 'mongoose';
const userSchema = new mongoose.Schema({
  name: String,
  password: String
});
const User = mongoose.model('User', userSchema);
export default User;
  • (ECMA 5.1)
var mongoose = require('mongoose');
var userSchema = new mongoose.Schema({
  name: String,
  password: String
});
var User = mongoose.model('User', userSchema);
module.exports = User