Skip to content

Instantly share code, notes, and snippets.

@abbasogaji
Created November 24, 2019 14:28
Show Gist options
  • Save abbasogaji/bc0177beb9df0ece135b079947d42706 to your computer and use it in GitHub Desktop.
Save abbasogaji/bc0177beb9df0ece135b079947d42706 to your computer and use it in GitHub Desktop.
user moogose schema
//
// ──────────────────────────────────────────────────────────────────────────── I ──────────
// :::::: U S E R M O N G O D B M O D E L : : : : : : : :
// ──────────────────────────────────────────────────────────────────────────────────────
/********************************************************************************************
*
* Information for stored in the document include;
* Name,
* Email,
* Password
*
*********************************************************************************************/
//
// ─── IMPORTS ────────────────────────────────────────────────────────────────────
//
const mongoose =
require("mongoose")
//
// ─── BODY ───────────────────────────────────────────────────────────────────────
//
const userSchema =
new mongoose.Schema ({
name : {
type : String,
required: true
},
email : {
type: String,
unique: true,
required: true
},
password : {
type: String,
required: true
},
emailVerification : {
isVerified : { type : Boolean, default : false},
code : String,
expiryDate : String
},
verified : {
type : Boolean,
required : true
}
},
{
timestamps : true
})
//
// ─── EXPORTS ────────────────────────────────────────────────────────────────────
//
module.exports = mongoose.model('User', userSchema)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment