Skip to content

Instantly share code, notes, and snippets.

@beaucarnes
Created April 29, 2019 13:25
Show Gist options
  • Save beaucarnes/3e7733973c371ceea00882a0d1365494 to your computer and use it in GitHub Desktop.
Save beaucarnes/3e7733973c371ceea00882a0d1365494 to your computer and use it in GitHub Desktop.
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const userSchema = new Schema({
username: {
type: String,
required: true,
unique: true,
trim: true,
minlength: 3
},
}, {
timestamps: true,
});
const User = mongoose.model('User', userSchema);
module.exports = User;
@usmanshah9
Copy link

Hi beau,
I was going through your MERN stack course on freeCodeCamp and I am suddenly confused on this naming convention , e.g user.model.js ??
is this same as user.js?
I cant seem to find the answer on web.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment