showing results for - "mongoose user model example"
Simona
09 Oct 2017
1var mongoose = require('mongoose');
2
3var UserSchema = new mongoose.Schema({
4  username: String,
5  email: String,
6  bio: String,
7  image: String,
8  hash: String,
9  salt: String
10}, {timestamps: true});
11
12mongoose.model('User', UserSchema);
13
Jermaine
05 Sep 2016
1  import mongoose from 'mongoose';
2  const { Schema } = mongoose;
3
4  const blogSchema = new Schema({
5    title:  String, // String is shorthand for {type: String}
6    author: String,
7    body:   String,
8    comments: [{ body: String, date: Date }],
9    date: { type: Date, default: Date.now },
10    hidden: Boolean,
11    meta: {
12      votes: Number,
13      favs:  Number
14    }
15  });
16