Skip to content

Instantly share code, notes, and snippets.

@mflisikowski
Last active October 24, 2018 07:26
Show Gist options
  • Save mflisikowski/ca8945de0cae3d7047276e9f833bcb81 to your computer and use it in GitHub Desktop.
Save mflisikowski/ca8945de0cae3d7047276e9f833bcb81 to your computer and use it in GitHub Desktop.
mongoose examples
import mongoose, { Schema } from 'mongoose'
const userSchema = new Schema({
loginInfo: {
providerID: {
type: String
},
providerKey: {
type: String
}
},
firstName: {
type: String
},
lastName: {
type: String
},
fullName: {
type: String
},
email: {
type: String
},
password: {
type: String
},
salt: {
type: String
},
settings: {
preferredLang: {
type: String
},
isReceiveNotification: {
type: Boolean
},
isReceiveEmail: {
type: Boolean
},
},
roles: {
type: Array
},
status: {
type: String
},
meta: {
_member: {
type: String
},
_version: {
type: Number
},
_created_by: {
type: String
},
_created: {
type: Date
},
_last_modified: {
type: Date
},
_owner: {
type: String
},
_modified_by: {
type: String
},
}
})
module.exports = mongoose.model('User', userSchema)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment