Skip to content

Instantly share code, notes, and snippets.

@FermiDirak
Last active November 20, 2019 08:28
Show Gist options
  • Save FermiDirak/178393cc889d8d437a206e3245a6b822 to your computer and use it in GitHub Desktop.
Save FermiDirak/178393cc889d8d437a206e3245a6b822 to your computer and use it in GitHub Desktop.
const mongoose = require('mongoose');
const { Schema } = mongoose;
const userSchema = new Schema({
username: {
type: String,
index: true,
unique: true,
dropDups: true,
required: true,
},
passwordHash: { //salted and hashed using bcrypt
type: String,
required: true,
},
});
const User = mongoose.model('User', userSchema);
module.exports = User;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment