Skip to content

Instantly share code, notes, and snippets.

@rxon
Created March 22, 2017 12:29
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 rxon/8f7a5e6d6f698fb41c7955c81d6a9e58 to your computer and use it in GitHub Desktop.
Save rxon/8f7a5e6d6f698fb41c7955c81d6a9e58 to your computer and use it in GitHub Desktop.
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