Created
March 22, 2017 12:29
-
-
Save rxon/8f7a5e6d6f698fb41c7955c81d6a9e58 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose'); | |
const UserSchema = new mongoose.Schema({ | |
userid: { | |
type: String, | |
required: true, | |
}, | |
password: { | |
type: String, | |
requird: true, | |
}, | |
first: { | |
type: Date, | |
default: Date.now, | |
}, | |
last: { | |
type: Date, | |
default: Date.now, | |
}, | |
visits: Number, | |
}); | |
mongoose.model('User', UserSchema); | |
mongoose.connect('mongodb://localhost/sample_db'); | |
const User = mongoose.model('User'); | |
const user = new User(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment