Skip to content

Instantly share code, notes, and snippets.

@ManishPoduval
Created March 1, 2021 02:44
Show Gist options
  • Save ManishPoduval/c5add369f89bde67f9f26f387c9cbecd to your computer and use it in GitHub Desktop.
Save ManishPoduval/c5add369f89bde67f9f26f387c9cbecd to your computer and use it in GitHub Desktop.
const { Schema, model } = require("mongoose");
// 1. Define your schema
let UserSchema = new Schema({
name: String,
email: {
type: String,
required: true
},
passwordHash: {
type: String,
required: true
}
})
// 2. Define your model
let UserModel = model('user', UserSchema)
// 3. Export your Model with 'module.exports'
module.exports = UserModel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment