Skip to content

Instantly share code, notes, and snippets.

@mohanramphp
Created May 16, 2020 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohanramphp/cb2ea097476763ab899e8da17b3700f9 to your computer and use it in GitHub Desktop.
Save mohanramphp/cb2ea097476763ab899e8da17b3700f9 to your computer and use it in GitHub Desktop.
User model declaration
const mongoose = require("mongoose");
const userSchema = new mongoose.Schema({
name: {
type: String,
required: true,
min: 6,
max: 255,
},
email: {
type: String,
required: true,
min: 6,
max: 255,
},
password: {
type: String,
required: true,
min: 6,
max: 1024,
},
date: {
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