Skip to content

Instantly share code, notes, and snippets.

@maisonm
Created November 2, 2018 20:59
Show Gist options
  • Save maisonm/58a71c22e2d33754bed9b0c9d3b1ee37 to your computer and use it in GitHub Desktop.
Save maisonm/58a71c22e2d33754bed9b0c9d3b1ee37 to your computer and use it in GitHub Desktop.
const mongoose = require('mongoose');
// *** NOTE: You never want to store a plain password in production! If someone gains access to your database, they will have access to all the users passwords.
// You can use something like PassportJS to handle saving passwords
const UserSchema = new mongoose.Schema({
username: {
type: String,
default: '',
},
password: {
type: String,
default: '',
},
email: {
type: String,
default: 'N/A',
},
registerDate: {
type: Date,
default: Date.now(),
},
});
module.exports = mongoose.model('User', UserSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment